title: Object class rotating wrongly when it's called in movieclip class (My Arcade Game)
body: <p>i have Cannon's class and it can rotate towards player !!</p>
  
  <pre><code>package com.musuh  {
  import flash.display.MovieClip;
  import flash.events.Event;
  import flash.events.MouseEvent;
  import flash.sampler.NewObjectSample;
  import com.ply.Heli;
  
  public class Cannon extends MovieClip {
      public var enTarget:Heli;
  
      public function Cannon(enTarget:Heli) {
          this.enTarget = enTarget;
  
          addEventListener(Event.ENTER_FRAME , update);
      }
  
      public function fire (m:MouseEvent){
          trace("fire");
      } 
  
      function update (e:Event) {
          if (parent != null) {
          var dx = enTarget.x - x ;
          var dy = enTarget.y - y ;
          var angle = Math.atan2(dy,dx)/Math.PI*180-90;
          rotation = angle;
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>when i called it to main class , it works fine (it can rotating towards player ) !!! , but when i called it inside Boss class (because in my game this boss can have at least 3 cannon ),it wasn't error but rotate wrongly towards player .. Why is it like that ?</p>
  
  <p>it's the Boss Class</p>
  
  <pre><code>package com.musuh  {
  import flash.display.MovieClip;
  import flash.events.Event;
  import flash.utils.getTimer;
  import com.peluru.bossBullet;
  import com.ply.Heli;
  import com.musuh.Cannon;
  
  public class Boss extends MovieClip {
      private var speedX:int = 6;
      private var dx:Number; // speed and direction
      public var bossHP:Number=20;
      private var gun:Cannon;
      public var hits:Array;
      public var target:Heli;
  
      public function Boss(target:Heli) {
      this.target = target;
      bossBullets = new Array();
      hits = new Array(hit1,hit2,hit3,hit4,hit5,hit6);
      addEventListener(Event.ADDED_TO_STAGE , onAddedToStage);
      addEventListener(Event.ENTER_FRAME, movePlane)
      addEventListener(Event.ENTER_FRAME, update)
      }
  
      private function onAddedToStage(event:Event):void 
      {
          gun = new Cannon(target);
          gun.x = 0;
          gun.y = 200;
          // add cannon to the MC Pitboss
          addChild(gun);
      }
  
      public function movePlane(e:Event){
          // move plane
          this.x +=speedX;  
          {
              speedX *= -1;
          }
          if (this.x &lt;= 20)
          {
              speedX *= -1;
          }
      }   
  }   
  }
  </code></pre>
  
  <p>and it's the <strong>SCREEN SHOOT</strong></p>
  
  <p><a href="http://img268.imageshack.us/img268/9250/1p0a.jpg" rel="nofollow">http://img268.imageshack.us/img268/9250/1p0a.jpg</a></p>