# Mouse follow help

**URL:** <https://forum.kirupa.com/t/mouse-follow-help/13638>\
**Category:** flash\
**Created:** [February 15, 2003, 11:25pm UTC](https://forum.kirupa.com/t/mouse-follow-help/13638 "2003-02-15T23:25:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![teamliquid](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@teamliquid](https://forum.kirupa.com/u/teamliquid)\
**Post date:** [February 15, 2003, 11:25pm UTC](https://forum.kirupa.com/t/mouse-follow-help/13638/1 "2003-02-15T23:25:30Z")

</div>

i am using a mouse follower where a line at the top of the page follows the mouse as it moves around. how can i set a parameter so that when the mouse reaches a certain point the line will stop following.

thanx for any help!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 15, 2003, 11:54pm UTC](https://forum.kirupa.com/t/mouse-follow-help/13638/2 "2003-02-15T23:54:29Z")

</div>

Use an if statement. something like this…

if(yourClip.\_x \<= 50){ yourClip.\_x = 50 }

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 16, 2003, 12:13am UTC](https://forum.kirupa.com/t/mouse-follow-help/13638/3 "2003-02-16T00:13:30Z")

</div>

stop following or just not go past that point in the follow?

Lost’s example is one that will prevent the clip which is following the mouse from going below an \_x of 50, but this wouldnt terminate the follow process. It all depends on how you have that set up (if you do in fact want to terminate the drag all together).

An easy way to do it is through a function, nullifying the function used to cause the mouse following movement.

ex:

followMouse = function(){  
this.\_x = this.\_parent.\_xmouse;  
this.\_y = this.\_parent.\_ymouse;  
}

myClip.movement = followMouse;

myClip.onEnterFrame = function(){  
//stuff  
this.movement();  
if (this.\_x \< 50) delete this.movement;  
}

This also lets you reuse followMouse on other clips andalso redefine movement back to be followMouse or even some other function.

again, it all depends on how you want to set it up

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 17, 2003, 1:55am UTC](https://forum.kirupa.com/t/mouse-follow-help/13638/4 "2003-02-17T01:55:13Z")

</div>

thanx allot guyz…

kirupa 4 life
