# Buttons that move toward the mouse

**URL:** <https://forum.kirupa.com/t/buttons-that-move-toward-the-mouse/189872>\
**Category:** flash\
**Created:** [June 6, 2006, 8:52pm UTC](https://forum.kirupa.com/t/buttons-that-move-toward-the-mouse/189872 "2006-06-06T20:52:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![HandyMan](https://avatars.discourse-cdn.com/v4/letter/h/a587f6/32.png) [@HandyMan](https://forum.kirupa.com/u/HandyMan)\
**Post date:** [June 6, 2006, 8:52pm UTC](https://forum.kirupa.com/t/buttons-that-move-toward-the-mouse/189872/1 "2006-06-06T20:52:53Z")

</div>

\*\* mouseInterval = setInterval(changeAlpha,10);

function changeAlpha() {  
contact\_mc.\_alpha = Math.round(\_root.\_xmouse/1024\*100);  
contact\_mc.\_x = Math.round(\_root.\_xmouse);  
}

\*\*This is the code, but I wish to manipulate the x\_mouse so that it inverts the value of X, thus making the button in this case move towards the mouse when I move the mouse towards the button,t, and away from the mouse when I move the mouse away from it…  
It should also go more opeqe when I move the mouse towards it, but It seems that it should be the same logic.  
Thanks in advance, dear Dudes! 🅱
