package {
import flash.display.*;
import flash.events.*;
public class PointingArrow extends MovieClip {
public function PointingArrow() {
addEventListener(Event.ENTER_FRAME, pointAtCursor);
}
public function pointAtCursor(event:Event) {
// 得到鼠标的相对位置
var dx:Number = mouseX - pointer.x;
var dy:Number = mouseY - pointer.y;
//得到角度的弧度制,转为度
var cursorAngle:Number = Math.atan2(dy,dx);
var cursorDegrees:Number = 360*(cursorAngle/(2*Math.PI));
// 指向光标
pointer.rotation = cursorDegrees;
}
}
}