# Onrollout follow the mouse, else stop following! :D

**URL:** https://forum.kirupa.com/t/onrollout-follow-the-mouse-else-stop-following-d/163481
**Category:** Uncategorized
**Created:** [September 22, 2005, 5:33pm UTC](https://forum.kirupa.com/t/onrollout-follow-the-mouse-else-stop-following-d/163481 "2005-09-22T17:33:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![GMaXDupper](https://avatars.discourse-cdn.com/v4/letter/g/bbce88/32.png) [@GMaXDupper](https://forum.kirupa.com/u/GMaXDupper)
#### Post date: [September 22, 2005, 5:33pm UTC](https://forum.kirupa.com/t/onrollout-follow-the-mouse-else-stop-following-d/163481/1 "2005-09-22T17:33:39Z")

</div>

hi there,  
i’m busy with something in flash… but i want to do the following thing.  
i got a MC … this must follow the mouse so onrollout follow the mouse  
and onrollover stop following the mouse. i tried this code:

```auto
 onClipEvent (enterFrame) { 
this.onRollOut = function () {
mx=_root._xmouse;
if (mx<_x) {
dx=_x-mx;
}
else {
dx=mx-_x;
}
moveSpeedx=dx/10;
if (mx<_x) {
_x=_x-moveSpeedx;
}
else {
_x=_x+moveSpeedx;
}
my=_root._ymouse;
if (my<_y) {
dy=_y-my;
}
else {
dy=my-_y;
}
moveSpeedy=dy/10;
if (my<_y) {
_y=_y-moveSpeedy;
}
else {
_y=_y+moveSpeedy;
}
}
} 

```

😃 i hope someone can help me…  
well cya later
