# AS:: Scrolling boundaries

**URL:** <https://forum.kirupa.com/t/as-scrolling-boundaries/248978>\
**Category:** flash\
**Created:** [January 14, 2008, 9:38am UTC](https://forum.kirupa.com/t/as-scrolling-boundaries/248978 "2008-01-14T09:38:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lilleypants](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@lilleypants](https://forum.kirupa.com/u/lilleypants)\
**Post date:** [January 14, 2008, 9:38am UTC](https://forum.kirupa.com/t/as-scrolling-boundaries/248978/1 "2008-01-14T09:38:41Z")

</div>

I have a movieclip that is: Width:168 and height:25.0

I’ve made some code that when you hold the mousedown it scrolls the movieclip plus or minus across X (horizontal). The only problem I have now is I need it so that when it reaches the edge of the movieclip it doesn’t scroll anymore.

Timeline script:

```auto
 
global.isMouseDown = false;
_global.scrollLeft = false;
_global.scrollRight = false;
var myListener:Object;
myListener = new Object();
myListener.onMouseDown = function() {
 _global.isMouseDown = true;
 trace("isMouseDown = true");
};
myListener.onMouseUp = function() {
 _global.isMouseDown = false;
 trace("isMouseDown = false");
}
Mouse.addListener(myListener);
 
onEnterFrame = function(){
 if (scrollRight == true){
 animF_mc._x -= 20;

 }else{ 
 if(scrollLeft == true){
 animF_mc._x += 20;

 }
 }
}

```

Button Script:

```auto
on (press){
 _global.scrollRight = true;

}
on (release) {
 _global.scrollRight = false;

}

```

Any help would be really great as I am stumped on this one.
