Hittests for mcs inside other mcs

Advertisement
I have a hittest code that's supposed to prevent an mc from moving into a space occupied by another mc. The thing is, the first mc is inside another mc and for some reason the hittest isn't registering. The code I'm using is below. Is it wrong somehow, or is there another code I should be using?
Key.addListener(keyListener);
this.onEnterFrame=loopF;
function loopF() {
     if (border.hitTest(player.playerHit._x+(player.playerHit._width/2), player.playerHit._y, true)) {
        player._x -= speed;
    if (border.hitTest(player.playerHit._x-(player.playerHit._width/2), player.playerHit._y, true)) {
        player._x += speed;
    if (border.hitTest(player.playerHit._x, player.playerHit._y+(player.playerHit._height/2), true)) {
        player._y -= speed;
    if (border.hitTest(player.playerHit._x, player.playerHit._y-(player.playerHit._height/2), true)) {
        player._y += speed;
Advertisement

Replay

it's not wrong but you probably want to use something like:
border.hitTest(player._x+player.playerHit._x+player.playerHit._width/2,player._y+player.pl ayerHit._y,true){
etc