Horizontal Scrolling Boundaries

Hi there,

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


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: