Got another problem

I got another problem that I just can’t figure out how to solve.

Player.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

function fl_MouseClickHandler(event:MouseEvent):void
{
addEventListener(Event.ENTER_FRAME, right);
}

function right (e:Event):void
{
    Player.x += 20;
    addEventListener(Event.ENTER_FRAME, touchwall);
}

function touchwall (e:Event):void
{
    if(Player.hitTestObject(Wall)){
        Player.x += 0;
        removeEventListener(Event.ENTER_FRAME, right);
    }
}

When I click Player, player goes to the right in speed 20. When he hits the wall he stops. BUT, he doesnt stop until the registation point hits the wall. Registation point is in the center. But I want him to stop directly when Player touches Wall.

And Im gonna have wall around the “map”. So i need him to stop if he touchs LeftWall, RightWall and what ever. :slight_smile: