# Constraining mouse trail

**URL:** <https://forum.kirupa.com/t/constraining-mouse-trail/120856>\
**Category:** Uncategorized\
**Created:** [August 27, 2004, 11:36pm UTC](https://forum.kirupa.com/t/constraining-mouse-trail/120856 "2004-08-27T23:36:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phantomxc](https://avatars.discourse-cdn.com/v4/letter/p/9dc877/32.png) [@phantomxc](https://forum.kirupa.com/u/phantomxc)\
**Post date:** [August 27, 2004, 11:36pm UTC](https://forum.kirupa.com/t/constraining-mouse-trail/120856/1 "2004-08-27T23:36:24Z")

</div>

I got this mouse trail effect from one of the tutorials and I would like to be able to constrain it to specified perimeters. I couldn’t figure it out im too noob with action scripting "=/ but heres my code(I changed it a bit)…flash mx pro btw…

menu\_drag.onEnterFrame = function() {  
var xMouse = \_root.\_xmouse;  
if(Math.abs(xMouse - this.\_x) \< 1) {  
this.\_x = xMouse;  
} else {  
this.\_x -= (this.\_x-xMouse) / 1000;  
}  
}

so just incase you didn’t get what im trying to do…I dont want the menu\_drag to go past a certain point on the x axis… plz help me 🙂 thanks
