# Moving object with button

**URL:** <https://forum.kirupa.com/t/moving-object-with-button/309819>\
**Category:** flash\
**Created:** [May 25, 2010, 2:32pm UTC](https://forum.kirupa.com/t/moving-object-with-button/309819 "2010-05-25T14:32:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![imcabee](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@imcabee](https://forum.kirupa.com/u/imcabee)\
**Post date:** [May 25, 2010, 2:32pm UTC](https://forum.kirupa.com/t/moving-object-with-button/309819/1 "2010-05-25T14:32:08Z")

</div>

Hello,

I want to move my movie clip on the stage with a button which is also on the stage. I want the movie clip to move along the x-axis and have it constantly be able to move when the button is clicked. I have a script but once the movie clip has moved I can’t move it again. I would like to be able to constantly have it move along the x-axis when the button is clicked and pick up where it left off.

Here is my script:

btnRight.onRelease=function() {  
var t:Number = photos\_MC.\_x;  
new mx.transitions.Tween(photos\_MC, “\_x”, mx.transitions.easing. Back.easeOut, t, 200, 8, true);  
}

Any help would be greatly appreciated!  
Thanks
