# How to stop character walking from when road scrolling reach the edge of screen?

**URL:** <https://forum.kirupa.com/t/how-to-stop-character-walking-from-when-road-scrolling-reach-the-edge-of-screen/253452>\
**Category:** Uncategorized\
**Created:** [March 1, 2008, 12:25pm UTC](https://forum.kirupa.com/t/how-to-stop-character-walking-from-when-road-scrolling-reach-the-edge-of-screen/253452 "2008-03-01T12:25:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kelga](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@Kelga](https://forum.kirupa.com/u/Kelga)\
**Post date:** [March 1, 2008, 12:25pm UTC](https://forum.kirupa.com/t/how-to-stop-character-walking-from-when-road-scrolling-reach-the-edge-of-screen/253452/1 "2008-03-01T12:25:22Z")

</div>

hi  
here i have a zipped fla file where i have problem with the character still wallking when road scrolling reach the end of the screen.  
how would i stop that?

heres script:

```auto
//road scrolling
road.onEnterFrame = function() {
    if (_xmouse>600 || _xmouse<200) {
        midpoint = 400;
        right = this._x+this._width;
        if (_root._xmouse<midpoint) {
            if (this._x<0) {
                this._x = this._x+((midpoint-_root._xmouse)/50);
            }
        } else {
            if (this._x+this._width>800) {
                this._x = this._x-((_root._xmouse-midpoint)/50);
            }
        }
    }
};
//4 different mascot movieclips and all invisible to begin with except one 
mascot.mascotfl._visible = 0;
mascot.mascotfr._visible = 1;
mascot.mascotwl._visible = 0;
mascot.mascotwr._visible = 0;
//mascot movieclips in/visible depending on _xmouse
mascot.onEnterFrame = function() {
    if ((_xmouse<400) && (_xmouse>200)) {
        mascot.mascotfl._visible = 1;
        mascot.mascotfr._visible = 0;
        mascot.mascotwl._visible = 0;
        mascot.mascotwr._visible = 0;
    }
    if (_xmouse<200) {
        mascot.mascotfl._visible = 0;
        mascot.mascotfr._visible = 0;
        mascot.mascotwl._visible = 1;
        mascot.mascotwr._visible = 0;
    }
    if ((_xmouse>400) && (_xmouse<600)) {
        mascot.mascotfl._visible = 0;
        mascot.mascotfr._visible = 1;
        mascot.mascotwl._visible = 0;
        mascot.mascotwr._visible = 0;
    }
    if (_xmouse>600) {
        mascot.mascotfl._visible = 0;
        mascot.mascotfr._visible = 0;
        mascot.mascotwl._visible = 0;
        mascot.mascotwr._visible = 1;
    }
};

```

thanks
