三角函数
//弧度=角度*Math.PI/180; //角度=弧度*180/Math.PI; var speed:Number = 5; addEventListener(Event.ENTER_FRAME,onEnterFrame); function onEnterFrame(event:Event):void { var dx:Number = mouseX - ball.x; var dy:Number = mouseY - ball.y; var angle:Number = Math.atan2(dy,dx); var dist:Number = Math.sqrt(dx * dx + dy * dy); ball.rotation = angle * 180 / Math.PI; var vx:Number = Math.cos(angle) * speed; var vy:Number = Math.sin(angle) * speed; ball.x += vx; ball.y += vy; }