# Mouse Listener

**URL:** https://forum.kirupa.com/t/mouse-listener/292759
**Category:** Uncategorized
**Created:** [July 18, 2009, 2:47pm UTC](https://forum.kirupa.com/t/mouse-listener/292759 "2009-07-18T14:47:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)
#### Post date: [July 18, 2009, 2:47pm UTC](https://forum.kirupa.com/t/mouse-listener/292759/1 "2009-07-18T14:47:46Z")

</div>

hi easy old stuff here :: I want an object to follow the mouse when I roll over an MC. And then I want the object to stop following when I rollOut :::  
here’s my code which doesn’t work, but probably only needs a tweek to fix it :: Can anyone help???!

```auto
var mouseEar:Object = new Object();
function hover()
{
    Mouse.addListener(mouseEar);
    Mouse.hide();
    mouseEar.onMouseMove = function()
    {
        zoom_mc._x = _xmouse;
        zoom_mc._y = _ymouse;
        updateAfterEvent();
    }
}
function endZoom()
{
    Mouse.show();
    removeListener(mouseEar);
}

```
