# \[CS4\]Limit an object's movement

**URL:** <https://forum.kirupa.com/t/cs4-limit-an-objects-movement/304323>\
**Category:** flash\
**Created:** [February 5, 2010, 10:52am UTC](https://forum.kirupa.com/t/cs4-limit-an-objects-movement/304323 "2010-02-05T10:52:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SangHee](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@SangHee](https://forum.kirupa.com/u/SangHee)\
**Post date:** [February 5, 2010, 10:52am UTC](https://forum.kirupa.com/t/cs4-limit-an-objects-movement/304323/1 "2010-02-05T10:52:14Z")

</div>

Hi,  
I’ve made a sort of sliding menu in Flash (CS4) which is basically a movie clip that has a function assigned to it that if the cursor goes over a button it starts moving in a direction.

```
Code:
_root.right.onRollOver = function() {
goRight = true;

```

};  
if (goRight) {  
\_root.content.\_x -= 10;  
}  
Now, I don’t want that “content” object to slide all the way out of the screen. How can I make it stop at certain position, say x=770? Or is there any better way?
