# Moving a MC with AS question

**URL:** <https://forum.kirupa.com/t/moving-a-mc-with-as-question/33586>\
**Category:** flash\
**Created:** [October 21, 2003, 10:24am UTC](https://forum.kirupa.com/t/moving-a-mc-with-as-question/33586 "2003-10-21T10:24:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![malkmus](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@malkmus](https://forum.kirupa.com/u/malkmus)\
**Post date:** [October 21, 2003, 10:24am UTC](https://forum.kirupa.com/t/moving-a-mc-with-as-question/33586/1 "2003-10-21T10:24:49Z")

</div>

As attached I was wondering if this is the only general coding way to move a MC to another position using action scripting.

Because due to the codes division it makes it seem like its easing out.

Problem is I need the speed to remain always constant.

Thanks,

---

<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:** [October 21, 2003, 1:11pm UTC](https://forum.kirupa.com/t/moving-a-mc-with-as-question/33586/2 "2003-10-21T13:11:09Z")

</div>

You can have a look at robert penner’s easing equations on his site: [www.robertpenner.com](http://www.robertpenner.com) Lots of fun 🙂

---

<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:** [October 21, 2003, 1:20pm UTC](https://forum.kirupa.com/t/moving-a-mc-with-as-question/33586/3 "2003-10-21T13:20:50Z")

</div>

i can’t look at your fla (at school) but if you want it to be constant instead of easing just put \_x += 5 instead of whatever you have to move the x value and \_y += 5 instead of whatever you have for your y movement.

---

<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:** [October 21, 2003, 3:18pm UTC](https://forum.kirupa.com/t/moving-a-mc-with-as-question/33586/4 "2003-10-21T15:18:36Z")

</div>

Now that I think of it, this is also implemented in the random motion tutorial. Basically:

```auto
nFrames = 20 ;
// I want to get there in 20 frames

curr_x = clip._x ;
curr_y = clip._y ;
next_x = random (500) ;
next_y = random (400) ;

// Each time I move, I will increment my posstion by
incr_x = (next_x - curr_x) / nFrames ;
incr_y = (next_y - curr_y) / nFrames ;
clip.i = 1 ;
clip.onEnterFrame = function () {
if (clip.i ++ < nFrames) {
this._x += incr_x ;
this._y += incr_y ;
}
else delete this.onEnterFrame ;
}

```
