# Got another problem

**URL:** <https://forum.kirupa.com/t/got-another-problem/322585>\
**Category:** Uncategorized\
**Created:** [May 26, 2011, 8:37am UTC](https://forum.kirupa.com/t/got-another-problem/322585 "2011-05-26T08:37:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheAwesomeDude](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@TheAwesomeDude](https://forum.kirupa.com/u/TheAwesomeDude)\
**Post date:** [May 26, 2011, 8:37am UTC](https://forum.kirupa.com/t/got-another-problem/322585/1 "2011-05-26T08:37:12Z")

</div>

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

```php
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. 🙂
