Mouse follow help

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!

Use an if statement. something like this…

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

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

thanx allot guyz…

kirupa 4 life