Really strange problem!

I need a movieclip to move against the player when the player touches the movieclip i used:

onClipEvent (enterFrame) {
    if (this.hitTest(_root.player)) {
        if (_root.player._x<=this._x) {
            this._x -= 0.5;
            } else {
            this._x += 0.5;
            }
        
    }
}

When i put the code in the movieclip on stage level it works perfectly. but when i put it INSIDE the movieclip it only moves right. no matter which side the player is, when the player touches the mc it moves right no matter what. anyone know why!?