# Follow the mouse, onrollover stop following :D

**URL:** <https://forum.kirupa.com/t/follow-the-mouse-onrollover-stop-following-d/163479>\
**Category:** Uncategorized\
**Created:** [September 22, 2005, 5:27pm UTC](https://forum.kirupa.com/t/follow-the-mouse-onrollover-stop-following-d/163479 "2005-09-22T17:27:57Z")\
**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:27pm UTC](https://forum.kirupa.com/t/follow-the-mouse-onrollover-stop-following-d/163479/1 "2005-09-22T17:27:57Z")

</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
