title: as3 movieclip rotation according to mouse
body: <p>Hi i'm looking to make a movieclip rotates depending on the angle from mouse. I have this code that seems fine according to what i search on net, but it's not working for me.<br>
  Btw, this movieclip has it's own class (Player.as) which is a child of the doc class.
  I already put the movieclip on the stage.  </p>
  
  <pre><code>public class Player extends MovieClip
  {
      private var player:MovieClip;
  
      public function Player()
      {
  
          this.addEventListener(Event.ADDED_TO_STAGE,onStage);
  
      }
      private function onStage(e:Event)
      {
  
          stage.addEventListener(KeyboardEvent.KEY_DOWN, on_key_down);
          stage.addEventListener(KeyboardEvent.KEY_UP, on_key_up);
          this.addEventListener(Event.ENTER_FRAME,on_enter_frame);
          removeEventListener(Event.ADDED_TO_STAGE,onStage);
      }
  
      private function on_enter_frame(e:Event)
      {
  
          var dist_Y:Number =mouseY -this.y ;
          var dist_X:Number =mouseX -this.x ;
          var angle:Number = Math.atan2(dist_Y,dist_X);
          var degrees:Number = angle * 180/ Math.PI;
          this.rotation = degrees;
  
      }
  
  
  }  
  </code></pre>
  
  <p>The movieclip rotates when i move the mouse, but not accordingly. I can't find the problem with this, hope anyone could help. Thanks.</p>