# Moving a MC in 2 ways

**URL:** <https://forum.kirupa.com/t/moving-a-mc-in-2-ways/287556>\
**Category:** Uncategorized\
**Created:** [May 3, 2009, 4:27pm UTC](https://forum.kirupa.com/t/moving-a-mc-in-2-ways/287556 "2009-05-03T16:27:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jxmckenzie](https://avatars.discourse-cdn.com/v4/letter/j/977dab/32.png) [@jxmckenzie](https://forum.kirupa.com/u/jxmckenzie)\
**Post date:** [May 3, 2009, 4:27pm UTC](https://forum.kirupa.com/t/moving-a-mc-in-2-ways/287556/1 "2009-05-03T16:27:08Z")

</div>

I’m working on a small piece that involves a movieclip that scrolls slowly from the beginning on enterframe, but when a button is clicked it goes directly to a certain point on the x axis.

The first piece of it is here:

[http://jxmckenzie.com/opus/index.html](http://jxmckenzie.com/opus/index.html)

You’ll see it’s kind of wack right now, bc I can’t figure this one issue out…

For the buttons I have this bit of code: (Where photo\_mc is the movie clip i’m moving)

[SIZE=1][COLOR=DarkGreen]final\_x=0;  
speed =3.5;  
photo\_width = 770;

btn\_1.onRelease = function() {  
final\_x =0;  
photo\_mc.\_x += (final\_x - photo\_mc.\_x)/speed;  
}  
btn\_2.onRelease = function() {  
final\_x =-photo\_width;  
photo\_mc.\_x += (final\_x - photo\_mc.\_x)/speed;  
}  
(…etc. for all the buttons)

[SIZE=2][COLOR=Black]And on the movie clip I have this bit (to get it to move):[/COLOR][/SIZE]

onClipEvent(enterFrame) {  
speed = -1;  
this.\_x += speed;  
}  
[/COLOR][/SIZE]

The motion pretty much works for me, but when I click on the button it doesn’t jump to the right point in the movie clip.

Will I just have to go in and hardcode the x values?

Any help is much appreciated! thanks.
