# onRelease stop function? help!

**URL:** <https://forum.kirupa.com/t/onrelease-stop-function-help/206045>\
**Category:** flash\
**Created:** [November 4, 2006, 2:13pm UTC](https://forum.kirupa.com/t/onrelease-stop-function-help/206045 "2006-11-04T14:13:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![odine](https://avatars.discourse-cdn.com/v4/letter/o/a5b964/32.png) [@odine](https://forum.kirupa.com/u/odine)\
**Post date:** [November 4, 2006, 2:13pm UTC](https://forum.kirupa.com/t/onrelease-stop-function-help/206045/1 "2006-11-04T14:13:17Z")

</div>

Hey guys, i have a pressing issue here was wondering if anyone could help me with.

I have a small movie that basically is a mask that when you click on it it follows the mouse to reveal the other image under it. I dont want a circle bit of a mask, i want the mask to be 1/2 the stage size and only scroll on the x plane. I have this setup and working more less except for the fact i cant “uncall” (yes i just made that up) the function. heres my code

[AS]  
var speed = 5;  
MovieClip.prototype.follow = function() {  
this.onEnterFrame = function() {  
this.\_x += (\_root.\_xmouse-this.\_x)/speed;  
if (Math.abs(\_root.\_xmouse-this.\_x)\<1 && Math.abs(\_root.\_ymouse-this.\_y)\<1) {  
delete this.onEnterFrame;  
}  
};  
};  
//drag the mask  
mask.onPress = function() {  
mask.follow();  
};  
[/AS]

as you can see the mask when pressed gets the follow function attatched, but i cant get it to stop moving when you release. I have tried all manners of onRelease to no avail…what can i do?

I would use the startDrag function but i love the easing (and i dont know how to constrain start/stopDrag to the X axis)

Any help would be great!

Thanks

–][–
