# Horizontal Scrolling Boundaries

**URL:** <https://forum.kirupa.com/t/horizontal-scrolling-boundaries/291632>\
**Category:** flash\
**Created:** [July 2, 2009, 3:12pm UTC](https://forum.kirupa.com/t/horizontal-scrolling-boundaries/291632 "2009-07-02T15:12:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ainsleyclark](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@ainsleyclark](https://forum.kirupa.com/u/ainsleyclark)\
**Post date:** [July 2, 2009, 3:12pm UTC](https://forum.kirupa.com/t/horizontal-scrolling-boundaries/291632/1 "2009-07-02T15:12:14Z")

</div>

Hi there,

I have literally just implemented some code in a class to make images scroll. The code is here:

```auto

if (_root._xmouse>150) {
        _root.speed = 0;
    } if (_root._xmouse<650) {
        _root.speed = 0;
    } if (_root._xmouse<150) {
        _root.speed = 10;
    } if (_root._xmouse>650) {
        _root.speed = -10;
    }
    
    this._x += _root.speed;
    if (this._x>Stage.width) {
        this._x = 1;
    } if (this._x<1) {
        this._x = Stage.width;
    }

```

However the scrolling does not stop and eventually goes back on itself and does a loop. Without creating any mc’s is there anyway to stop this from happening and create a boundary?

Any help would be greatly appreciated.

Thankyou :beer2:
