# Object follows mouse with ease only when moused over

**URL:** <https://forum.kirupa.com/t/object-follows-mouse-with-ease-only-when-moused-over/178584>\
**Category:** Uncategorized\
**Created:** [February 12, 2006, 6:16am UTC](https://forum.kirupa.com/t/object-follows-mouse-with-ease-only-when-moused-over/178584 "2006-02-12T06:16:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pnett](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@pnett](https://forum.kirupa.com/u/pnett)\
**Post date:** [February 12, 2006, 6:16am UTC](https://forum.kirupa.com/t/object-follows-mouse-with-ease-only-when-moused-over/178584/1 "2006-02-12T06:16:06Z")

</div>

i have been trying to figure out how to make an object move when its moused over.  
once moused over, i would like for it to move with an ease (penner), but once the mouse is off the object, i would like it to ease into a dock position.

i have been using penners code…

[COLOR=“DarkRed”]function glideToMouse () {  
this.\_x += (\_parent.\_xmouse - this.\_x) \* .2;  
this.\_y += (\_parent.\_ymouse - this.\_y) \* .2;  
};

this.onMouseMove = function () {  
this.onEnterFrame = this.glideToMouse;  
};[/COLOR]

but this works for where the mouse anywhere in the movie. i only want the object to move when it is moused over.

hope this makes sense.

thanks,

paul
