# Menu following mouse

**URL:** https://forum.kirupa.com/t/menu-following-mouse/184361
**Category:** flash
**Created:** [April 4, 2006, 4:54pm UTC](https://forum.kirupa.com/t/menu-following-mouse/184361 "2006-04-04T16:54:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![fr\_ode](https://avatars.discourse-cdn.com/v4/letter/f/9d8465/32.png) [@fr\_ode](https://forum.kirupa.com/u/fr_ode)
#### Post date: [April 4, 2006, 4:54pm UTC](https://forum.kirupa.com/t/menu-following-mouse/184361/1 "2006-04-04T16:54:50Z")

</div>

Hi!

I have a menu inside a movieclip. It’s suppose to follow the mouse with ease (as in kirupas tutorial), and when it hits the center - stop following it until the mouse rolls out.

I have been trying all kinds of stuff to get my menu to behave properly,  
but I can’t really figure it out. Can anybody point me in the right direction, or maybe help me out?

```auto
onClipEvent (load) {
    _x = 0;
    _y = 0;
    speed = 4;
}
onClipEvent (enterFrame) {
    if ((_root._xmouse>(this._x-40)) and (_root._xmouse<(this._x+40)) and (_root._ymouse>(this._y-9)) and (_root._ymouse<(this._y+9))) {
        //
    } else {
        endX = _root._xmouse;
        endY = _root._ymouse;
        _x += (endX-_x)/speed;
        _y += (endY-_y)/speed;
    }
}

```

:afro:

---

<div class="post-metadata">

### Author: ![fr\_ode](https://avatars.discourse-cdn.com/v4/letter/f/9d8465/32.png) [@fr\_ode](https://forum.kirupa.com/u/fr_ode)
#### Post date: [April 4, 2006, 6:00pm UTC](https://forum.kirupa.com/t/menu-following-mouse/184361/2 "2006-04-04T18:00:46Z")

</div>

it’s probably very ease to achieve, however - I need help!
