# MC Positioning/Moving

**URL:** <https://forum.kirupa.com/t/mc-positioning-moving/16816>\
**Category:** flash\
**Created:** [March 28, 2003, 5:29pm UTC](https://forum.kirupa.com/t/mc-positioning-moving/16816 "2003-03-28T17:29:32Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![asphaltcowboy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/asphaltcowboy/32/128_2.png) [@asphaltcowboy](https://forum.kirupa.com/u/asphaltcowboy)\
**Post date:** [March 28, 2003, 5:29pm UTC](https://forum.kirupa.com/t/mc-positioning-moving/16816/1 "2003-03-28T17:29:32Z")

</div>

hi guys, been a while, but still 😃 I’ve got this scripting to move an MC:[AS]on (release) {  
\_x = 0;  
\_y = -170;  
}[/AS]is there a way to code it so that eases into position rather than just jumps? And preferably without having to set up a motion tween? Any help appreciated!

---

<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:** [March 28, 2003, 5:36pm UTC](https://forum.kirupa.com/t/mc-positioning-moving/16816/2 "2003-03-28T17:36:06Z")

</div>

[http://www.kirupa.com/developer/mx/easing\_mouseclick.htm](http://www.kirupa.com/developer/mx/easing_mouseclick.htm)

---

<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:** [March 28, 2003, 5:38pm UTC](https://forum.kirupa.com/t/mc-positioning-moving/16816/3 "2003-03-28T17:38:34Z")

</div>

hm… ok thanks…  
thing is… I dont want to go to my mouse position. there’s an up and a down arrow. want the MC to ease up with one and down with the other (obviously). Is there particular bits of this code that I need to isolate? is it just a case of adding the speed line?

---

<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:** [March 28, 2003, 5:41pm UTC](https://forum.kirupa.com/t/mc-positioning-moving/16816/4 "2003-03-28T17:41:13Z")

</div>

That tutorial shows a theory. The theory of easing.

Easing follows a specific equation, and it is shown in that tutorial.

Whatever endX and endY equal, it will move there.

So to make it move to a new location, you have to change what endX and endY equal.

---

<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:** [March 28, 2003, 5:42pm UTC](https://forum.kirupa.com/t/mc-positioning-moving/16816/5 "2003-03-28T17:42:32Z")

</div>

ooopsh! sorry lost… I think all this AS has sent me slightly crazy (-:

---

<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:** [March 28, 2003, 5:54pm UTC](https://forum.kirupa.com/t/mc-positioning-moving/16816/6 "2003-03-28T17:54:16Z")

</div>

erk 😕 I really can’t work this out… 😕

---

<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:** [March 28, 2003, 5:57pm UTC](https://forum.kirupa.com/t/mc-positioning-moving/16816/7 "2003-03-28T17:57:14Z")

</div>

Well you would need to define an endX and endY variable to start with.

[AS]onClipEvent(load){  
var endX = this.\_x  
var endY = this.\_y  
}[/AS]

Then when you release, you will want to set the value of the endX and endY variables

[AS]on (release){  
endX = newPositionX;  
endY = newPositionY;  
}[/AS]

Then you run the onEnterFrame with the easing forumla.

---

<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:** [March 28, 2003, 6:30pm UTC](https://forum.kirupa.com/t/mc-positioning-moving/16816/8 "2003-03-28T18:30:19Z")

</div>

ok, is there a way to set up a button so that it makes the MC move a certain distance everytime you click it - rather than having to set lots and lots of end points?

---

<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:** [March 28, 2003, 7:31pm UTC](https://forum.kirupa.com/t/mc-positioning-moving/16816/9 "2003-03-28T19:31:51Z")

</div>

endX += amount  
endY += amount

It will add whatever value you put for amount onto the current value of endX and endY

---

<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:** [March 28, 2003, 7:34pm UTC](https://forum.kirupa.com/t/mc-positioning-moving/16816/10 "2003-03-28T19:34:03Z")

</div>

thnx lib, I literally just found this on a different thread:[AS]on(release){  
\_root.myMC.\_y+=5  
}  
[/AS]which is great, it moves the right amount, and endlessly, but I still cant get it easing nicely, it just jumps… do I have to set specific stop points for it to be able to ease? ☹

---

<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:** [March 28, 2003, 7:39pm UTC](https://forum.kirupa.com/t/mc-positioning-moving/16816/11 "2003-03-28T19:39:52Z")

</div>

[AS]on(release){  
\_root.myMC.\_y+=5  
}[/AS]

is entirely different from the method mentioned here.  
[http://www.kirupa.com/developer/mx/easing\_mouseclick.htm](http://www.kirupa.com/developer/mx/easing_mouseclick.htm)

The easing formula requires you to state where you want the clip to go to by defining the endX and endY coordinates.

this.\_y+=5 just moves the clip every 5 pixels endlessly unless you use an if statement to detect its position and tell it to stay in the same spot if it is out of bounds.
