# Moving buttons

**URL:** <https://forum.kirupa.com/t/moving-buttons/200039>\
**Category:** Uncategorized\
**Created:** [September 8, 2006, 5:38am UTC](https://forum.kirupa.com/t/moving-buttons/200039 "2006-09-08T05:38:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdmt](https://avatars.discourse-cdn.com/v4/letter/g/b3f665/32.png) [@gdmt](https://forum.kirupa.com/u/gdmt)\
**Post date:** [September 8, 2006, 5:38am UTC](https://forum.kirupa.com/t/moving-buttons/200039/1 "2006-09-08T05:38:01Z")

</div>

hi everybody!  
i’d like to know how to make buttons move in the direction the mouse is moved.  
like this site:

> **[SYDNEY BLU](https://www.facebook.com/djsydneyblu/)**
>
> SYDNEY BLU. 206K likes. DJ/Producer/Owner of Blu Music

i was playing with this code, but still I do not obtain the wished effect:

import mx.transitions.Tween;  
mc1.onRollOver=function(){  
var tw1:Tween = new Tween(mc1, “\_x”, mx.transitions.easing.Bounce.easeOut, this.\_x, this.\_x+30_Math.random(), 3, true);  
var tw2:Tween = new Tween(mc1, “\_y”, mx.transitions.easing.Bounce.easeOut, this.\_y, this.\_y+30_Math.random(), 3, true);  
var tw3:Tween = new Tween(mc1, “\_rotation”, mx.transitions.easing.Bounce.easeOut, this.\_rotation, this.\_rotation+30\*Math.random(), 3, true);  
}

i guess it isn’t difficult, but i don’t know so much actionsript.

thanx in advance, i hope you can help me…

cheers!
