Flash as2 Need help stopping my background from scrolling

Really simple, As my character moves left and right, so does the background. What I am trying to do is when my character reaches the edge of the screen, the background will not scroll. What I have is a document 600px X 300 px. I made a movieclip called “Walls”. I put this at the right edge of the screen and dropped the alpha to 0. I put a simple hitTest in, so when my character hits the “Walls” movieclip, the background will stop scrolling in that direction. Unfortionatly, when my character hits the “Walls” movieclip, as long as the right key is down, the background will keep moving. Maybe I am just puting my code in the wrong place? Here is what the code looks like:

class Background extends MovieClip 
{
    function onEnterFrame()
    {
        if(Key.isDown(Key.RIGHT))
        {
            _x -= 5;
            if(_root.Hero.hitTest(_root.Walls))
            {
                _x -= 0;
            }
        }
        if(Key.isDown(Key.LEFT))
        {
            _x += 5;
        }
        
    }
}


I thought that if I put

            if(_root.Hero.hitTest(_root.Walls))
            {
                _x -= 0;
            }

then the background would stop moving right because I am saying "Hey, if Hero hits this wall, then the x coordinates of the Background will be 0. So, in theory, it should stop moving. What am I missing?