title: As3 hittesting doesn't really work (nested)
body: <p>I got a tank.</p>
  
  <p>I got a hero (controllable character).</p>
  
  <p>The tank has a nested movieclip which has a very thin surface area.</p>
  
  <p>Yet, the thing detects a collision when it's not even touching the hero.</p>
  
  <pre><code>public class tank_sight extends MovieClip
  {
      private var _root:MovieClip;
  
      public function tank_sight() 
      {
          addEventListener(Event.ADDED, beginClass);
      }
  
      private function beginClass(event:Event):void
      {
          _root = MovieClip(root);
          addEventListener(Event.ENTER_FRAME, loop);
      }
  
      private function loop(event:Event):void
      {
          if(this.hitTestObject(_root.hero.hitbox))
          {
              this.gotoAndStop(2);
              trace("HIT");
              fire();
          }
          else
          {
              this.gotoAndStop(1);
          }
      }
  
      private function fire():void
      {
          var shell:Shell = new Shell(x, y, rotation - 180);
          _root.addChild(shell);
      }
  }
  </code></pre>
  
  <p>What's wrong? I don't get it.</p>
  
  <p>EDIT: Sight is rotating, so that's probably why. I tried using this code on the player class:</p>
  
  <pre><code>    point = _root.tanks.barrel.sight.localToGlobal(new Point());
  
          if(this.hitTestPoint(point.x, point.y, false))
                  {
                      trace("HIT");
                  }
  </code></pre>
  
  <p>But it doesn't work.. It never traces "HIT", unless I stand in some weird location at certain times.</p>