# Mouse follow snap menu

**URL:** <https://forum.kirupa.com/t/mouse-follow-snap-menu/20539>\
**Category:** Uncategorized\
**Created:** [May 9, 2003, 11:47pm UTC](https://forum.kirupa.com/t/mouse-follow-snap-menu/20539 "2003-05-09T23:47:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Batman124617](https://avatars.discourse-cdn.com/v4/letter/b/45deac/32.png) [@Batman124617](https://forum.kirupa.com/u/Batman124617)\
**Post date:** [May 9, 2003, 11:47pm UTC](https://forum.kirupa.com/t/mouse-follow-snap-menu/20539/1 "2003-05-09T23:47:19Z")

</div>

Hola! Does anyone know how to make a mouse follow, on a menu, on an x-axis, that snaps into place when the mouse is moved over certain menu buttons? I’ve created my own mouse follow that follows my mouse on an x-axis and is restricted to the menu area using the following code adapted from kirupa actionscript tutorial:

[AS]  
onClipEvent (enterFrame) {  
getlimits = \_root.menu.getBounds(\_root);  
speed = 5;  
//get the limits of the normal pic movie  
if (\_root.\_xmouse\>=getlimits.xMin && \_root.\_xmouse\<=getlimits.xMax && \_root.\_ymouse\>=getlimits.yMin && \_root.\_ymouse\<=getlimits.yMax) {  
this.endX = \_root.\_xmouse;  
\_x += (endX-\_x)/speed;  
}  
}  
[/AS]

This works find and I like the effect I get from this, but I would ultimately like the mouse follow to snap onto a certain point on a button when the mouse is over the button. When rolled on to another button, it’ll move to that button. Did I explain it clearly?  
Much thanks is advance.

:cool:
