# onMouseMove function not working

**URL:** <https://forum.kirupa.com/t/onmousemove-function-not-working/245372>\
**Category:** flash\
**Created:** [November 28, 2007, 11:55pm UTC](https://forum.kirupa.com/t/onmousemove-function-not-working/245372 "2007-11-28T23:55:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [November 28, 2007, 11:55pm UTC](https://forum.kirupa.com/t/onmousemove-function-not-working/245372/1 "2007-11-28T23:55:57Z")

</div>

Ok, the code below does get called when the mouse moves, but its like it doesnt re-run the tween until the the mouse stops moving. Any idea on how to fix it?

see example at:  
[www.ronnieswietek.com](http://www.ronnieswietek.com)

click on portfolio and select web or interactive from the drop down and you will see what I mean.

```php

mouseListener = new Object();
mouseListener.onMouseMove = function() {
    if (mc_mask.hitTest(_root._xmouse, _root._ymouse, false)) {
        mousePosX = (_root._xmouse-mc_mask._x);
        mousePosY = (_root._ymouse-mc_mask._y);
        proxX = Math.abs(mousePosX-mc_mask._width/2)/(mc_mask._width/2)*10;
        proxY = Math.abs(mousePosY-mc_mask._height/2)/(mc_mask._width/2)*10;
        pic.tween("_x",_root._xmouse-(pic._width*(mousePosX/mc_mask._width)),20/proxX,"easeOutExpo");
        pic.tween("_y",_root._ymouse-(pic._height*(mousePosY/mc_mask._height)),20/proxY,"easeOutExpo");
    }
};

Mouse.addListener(mouseListener);

```
