# Clipevent with buttons prob

**URL:** <https://forum.kirupa.com/t/clipevent-with-buttons-prob/66051>\
**Category:** Uncategorized\
**Created:** [October 1, 2004, 10:54pm UTC](https://forum.kirupa.com/t/clipevent-with-buttons-prob/66051 "2004-10-01T22:54:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brndn](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@brndn](https://forum.kirupa.com/u/brndn)\
**Post date:** [October 1, 2004, 10:54pm UTC](https://forum.kirupa.com/t/clipevent-with-buttons-prob/66051/1 "2004-10-01T22:54:42Z")

</div>

hi got this off a tutorial, and modified it. if you check the file the round button moves on click! it tracks \_xmouse position

im trying to get it to track the mouse but only if one of the three buttons are pressed?

---

<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 1, 2004, 11:41pm UTC](https://forum.kirupa.com/t/clipevent-with-buttons-prob/66051/2 "2004-10-01T23:41:13Z")

</div>

Put this on the MC that moves.  
[AS]  
onClipEvent (load) {  
\_x = -51;  
speed = 8;  
}  
onClipEvent (enterFrame) {  
\_x += (endX-\_x)/speed;  
\_root.button1.onPress = function() {  
endx = 58;  
};  
}  
[/AS]  
Then change the instance name of your button that makes the MC move, to **button1**.

---

<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 2, 2004, 12:38am UTC](https://forum.kirupa.com/t/clipevent-with-buttons-prob/66051/3 "2004-10-02T00:38:12Z")

</div>

cheers my friend.!!!
