title: AS3 removeChild and collisions : issue
body: <p>I'm working in a little shooting game with Flash and AS3. I'm still beginning for using Class documents, but I managed to understand thanks to tutorials.
  So here's how it works :
  I used the HitTestObject when the Enemy MovieClip hits a bullet, shot by the user :</p>
  
  <pre><code>//checking if it is touching any bullets
  //we will have to run a for loop because there will be multiple bullets
  for(var i:int = 0;i&lt;_root.bulletContainer.numChildren;i++){
      //numChildren is just the amount of movieclips within
      //the bulletContainer.
  //we define a variable that will be the bullet that we are currently
  //hit testing.
  var bulletTarget:MovieClip = _root.bulletContainer.getChildAt(i);
  
  //now we hit test
  
  if(hitTestObject(bulletTarget)){
      hit++;
      if(hit==4)
      {
      gotoAndPlay(4); //the Enemy MC is removed after 4 hits(parent.removeChild(this))
      removeEventListener(Event.ENTER_FRAME, eFrame);
      //the Bullet MC is removed with its Listeners
      _root.bulletContainer.removeChild(bulletTarget);
      bulletTarget.removeListeners();
      }
  
      if(hit&lt;4)
      {
      gotoAndPlay(2);
      _root.bulletContainer.removeChild(bulletTarget);
      bulletTarget.removeListeners();
  
      }
      if(hit &gt; 4)
      {
      _root.bulletContainer.removeChild(bulletTarget);
      bulletTarget.removeListeners();
          hit = 0;
      }
  }
  }
  </code></pre>
  
  <p>So after 4 hits, it is completely removed from the screen.
  The eFrame function remove the Enemy MC if it goes off the stage :</p>
  
  <pre><code>    private function eFrame (event:Event):void{
          x+=speed;
          if(this.x &gt; stage.stageWidth + 50){
              removeEventListener(Event.ENTER_FRAME, eFrame);
              _root.removeChild(this);
      }
  }
  </code></pre>
  
  <p>I also put a command that detects collisions between the Enemy MC and the Player (that I gave the "craft" instance name) :</p>
  
  <pre><code>if(hitTestPoint(_root.craft.x -203.25, _root.craft.y - 44.9, collide)) 
      {
         _root.dmg.width+=8;//reduce the life bar
          removeEventListener(Event.ENTER_FRAME, eFrame); 
          gotoAndPlay(4); 
      }
      if(hitTestPoint(_root.craft.x -210.6, _root.craft.y - 32.9, collide))
      {
         _root.dmg.width+=8;
          removeEventListener(Event.ENTER_FRAME, eFrame);
          gotoAndPlay(4);
  
      }
      if(hitTestPoint(_root.craft.x -210.6, _root.craft.y - 6, collide))
      {
         _root.dmg.width+=8;
          removeEventListener(Event.ENTER_FRAME, eFrame);
          gotoAndPlay(4);
      }
      if(hitTestPoint(_root.craft.x -211.4, _root.craft.y + 20, collide))
      {
         _root.dmg.width+=8;
          removeEventListener(Event.ENTER_FRAME, eFrame);
          gotoAndPlay(4);
      }
  ...//There is a lot of other points with the same results...
  </code></pre>
  
  <p>So the Enemy MC is also removed if it hits the craft MC (Player). But I encountered an issue : when the Enemy MC is hit (4 times by the Bullet movieclips "shot" by the user which removes it) <strong>but also <em>collided</em></strong> by the player, <em>it is not removed as it ought to be...</em> 
  It is instead still displayed on the screen, and is static : it can't be hit neither by a bullet MC, neither by the player MC...</p>
  
  <p>I think this is because of the <code>parent.removeChild(this)</code> executed from <code>gotoAndPlay(4)</code> of the Enemy MC, which causes that issue : it is executed <strong>a twice</strong> (because the Enemy MC is <em>destroyed by the Bullet MC AND by the Player</em>)... 
  Anyone has an idea to solve that double execution of <code>removeChild</code> ? 
  If you want to have more info, you can download the source :
  <a href="https://www.dropbox.com/s/wvl116wjqpu69d0/shoot_aircraft%20game.zip?dl=0" rel="nofollow">https://www.dropbox.com/s/wvl116wjqpu69d0/shoot_aircraft%20game.zip?dl=0</a></p>
  
  <p>Thank you for your help.</p>