# On roll over I have an mc follow the mouse, but h

**URL:** https://forum.kirupa.com/t/on-roll-over-i-have-an-mc-follow-the-mouse-but-h/211156
**Category:** Uncategorized
**Created:** [December 28, 2006, 1:12am UTC](https://forum.kirupa.com/t/on-roll-over-i-have-an-mc-follow-the-mouse-but-h/211156 "2006-12-28T01:12:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dtrace](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dtrace](https://forum.kirupa.com/u/dtrace)
#### Post date: [December 28, 2006, 1:12am UTC](https://forum.kirupa.com/t/on-roll-over-i-have-an-mc-follow-the-mouse-but-h/211156/1 "2006-12-28T01:12:50Z")

</div>

Basically, you roll over a piece of text, and it follows the mouse, using the following code.  
onClipEvent (load) {  
\_x = this.\_x;  
\_y = this.\_y;  
speed = 44;  
}  
onClipEvent (enterFrame) {  
if (\_global.penthouse\*\*\*\* == 1) {  
endX = \_root.\_xmouse;  
endY = \_root.\_ymouse;  
\_x += (endX-\_x)/speed;  
\_y += (endY-\_y)/speed;  
}  
}

However, the problem is that when I roll off this thing, it is sort of snapping back to it’s original position. I’m thinking there is a way to animate it back to it’s original state, but I’m not sure how to do this.  
Could you show me the way?  
Thanks.
