# Quick ActionScript Question for a Newbie

**URL:** <https://forum.kirupa.com/t/quick-actionscript-question-for-a-newbie/65588>\
**Category:** flash\
**Created:** [September 28, 2004, 12:47am UTC](https://forum.kirupa.com/t/quick-actionscript-question-for-a-newbie/65588 "2004-09-28T00:47:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChaoticGood](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@ChaoticGood](https://forum.kirupa.com/u/ChaoticGood)\
**Post date:** [September 28, 2004, 12:47am UTC](https://forum.kirupa.com/t/quick-actionscript-question-for-a-newbie/65588/1 "2004-09-28T00:47:19Z")

</div>

Greetings,

I have a movie clip I am moving from the left side of the stage to the right using AS, however I can’t seem to get the clip to scale larger or stop.

I was able to succesfully get the clip to move, so I am wonderging if anyone can help me stop the MC and gradually make the clip larger.

Here is the AS as it stands now -

_onClipEvent (load) {  
\_x=24;  
\_y=111.7;  
\_xscale=\_yscale=0;  
\_alpha = 10;  
}  
onClipEvent (enterFrame) {  
\_x=\_x+3;  
\_xscale=\_yscale=+100  
\_xscale=\_yscale=+100;  
\_alpha = \_alpha+2;  
}  
onClipEvent (data) {  
stop();  
}_

All help is greatly appreciated.

Best,  
CG

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 28, 2004, 10:23am UTC](https://forum.kirupa.com/t/quick-actionscript-question-for-a-newbie/65588/2 "2004-09-28T10:23:04Z")

</div>

You can either do it this way:  
onClipEvent (enterFrame) {  
\_x=\_x+3;  
\_xscale=\_xscale+100  
\_yscale=\_yscale+100;  
\_alpha = \_alpha+2;  
}  
or this way:  
onClipEvent (enterFrame) {  
\_x=\_x+3;  
\_xscale+=100;  
\_yscale+=100;  
\_alpha+=+2;  
}

It’s two ways of writing code that does the same thing.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 28, 2004, 1:19pm UTC](https://forum.kirupa.com/t/quick-actionscript-question-for-a-newbie/65588/3 "2004-09-28T13:19:25Z")

</div>

**Thanks glkngs** - I was able to get the movie clip to scale larger. Any ideas on how to stop the moving object at a given \_x coordinate.

The script - \_x=\_x+3 moves my object, but it just keeps on going off the stage. How can I get it to stop somewhere?

Best,

ChaoticGood

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 28, 2004, 5:41pm UTC](https://forum.kirupa.com/t/quick-actionscript-question-for-a-newbie/65588/4 "2004-09-28T17:41:18Z")

</div>

```auto

onClipEvent (enterFrame) {
if (_x<240) {
_x += 2;
} else {
this.deleteOnEnterFrame;
}
}

```

that will move a clip across the stage until it’s x coordinate equals 240. when it does, it just deletes the actions in the onEnterFrame.

and, if you want to move the clip across the stage in a fluid motion (my preference), just incorporate the concept of easing:

```auto

onClipEvent (enterFrame) {
 limitX = 440;
 speed = 3;
 if (_x<limitX) {
  _x += (limitX-this._x)/speed;
 } else {
  this.deleteOnEnterFrame;
 }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 28, 2004, 7:41pm UTC](https://forum.kirupa.com/t/quick-actionscript-question-for-a-newbie/65588/5 "2004-09-28T19:41:32Z")

</div>

**Many thanks, maximum\_flash**. I was missing the conditionals on the script.

On a side note, I know this animation can be done with tweening, but I am curious about when tweening should be used and when ActionScript should be used…?

Best,  
CG

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 28, 2004, 7:57pm UTC](https://forum.kirupa.com/t/quick-actionscript-question-for-a-newbie/65588/6 "2004-09-28T19:57:40Z")

</div>

me, i try and use actionScript for **everything**. then, there are motion tween people who would rather eat nails than script movement. i would say that the first option should be actionScript because it cuts down on file sizes and also gives you more options.

just my $.02

your welcome for the scripts.
