# Seting boundries when moving mc with .\_x values

**URL:** <https://forum.kirupa.com/t/seting-boundries-when-moving-mc-with--x-values/66406>\
**Category:** Uncategorized\
**Created:** [October 5, 2004, 5:33pm UTC](https://forum.kirupa.com/t/seting-boundries-when-moving-mc-with--x-values/66406 "2004-10-05T17:33:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![greed](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@greed](https://forum.kirupa.com/u/greed)\
**Post date:** [October 5, 2004, 5:33pm UTC](https://forum.kirupa.com/t/seting-boundries-when-moving-mc-with--x-values/66406/1 "2004-10-05T17:33:49Z")

</div>

K heres my deal. I’m moving this little red box along the x axis. It just moves w/ the mouse but it moves off the movie clip area, i want to be able to set the left and right boundries. Heres my code. Any help would be great.

[color=red]mc\_movingBox.onEnterFrame = function() {  
var xMouse = \_root.\_xmouse;  
if(Math.abs(xMouse - this.\_x) \< 1) {  
this.\_x = xMouse;  
} else {  
this.\_x -= (this.\_x-xMouse) / 6;  
}  
}[/color]  
[color=black][/color]  
Graeme
