2012-12-05 54 views
0

我有一个HitTestObject,它会在用子弹击中时移除movieClip(敌人)。AS3 HitTest gotoAndPlay而不是removeChild

这是代码:

if (hitTestObject(bulletTarget)) { 
    //remove this from the stage if it touches a bullet 
    removeEventListener(Event.ENTER_FRAME, eFrame); 
    _root.removeChild(this); 
    //also remove the bullet and its listeners 
    _root.bulletContainer.removeChild(bulletTarget); 
    bulletTarget.removeListeners(); 
    //up the score 
    _root.score += 5; 
} 

但不是立即删除它,我希望影片剪辑(敌人)来播放下一帧,这是爆炸的动画,并且一旦爆炸发生它应该被删除。

回答

0

傻我!

我改变

_root.removeChild(this); 

this.gotoAndPlay(2); 

,然后在我的爆炸片段结束我加

this.parent.removeChild(this); 
+0

所以最好纪念这一问题的回答 –