# Setting X and Y limitations

**URL:** <https://forum.kirupa.com/t/setting-x-and-y-limitations/314672>\
**Category:** flash\
**Created:** [October 6, 2010, 12:52am UTC](https://forum.kirupa.com/t/setting-x-and-y-limitations/314672 "2010-10-06T00:52:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eddie\_E](https://avatars.discourse-cdn.com/v4/letter/e/2acd7d/32.png) [@Eddie\_E](https://forum.kirupa.com/u/Eddie_E)\
**Post date:** [October 6, 2010, 12:52am UTC](https://forum.kirupa.com/t/setting-x-and-y-limitations/314672/1 "2010-10-06T00:52:26Z")

</div>

Hi

I currently have a script that allows the user to click on a right or left arrow to scroll across a movie under a mask, but currently they can scroll it so you don’t see anything in the middle. How can I add an X and Y axis limitations so this doesnt happen to the following script:

```auto
var move_fn:String="";
var speed:Number = 5;

left_arrow.onRelease=right_arrow.onRelease=function(){
move_fn=""
}
left_arrow.onPress=function(){
move_fn="left"
}
right_arrow.onPress=function(){
move_fn="right"
}
this.onEnterFrame=function(){
if(move_fn=="left"){
object_mc._x-=speed;
}
if(move_fn=="right"){
object_mc._x+=speed;
}
} 

```

Thanks

Eddie
