as3 根据鼠标移动方向

gz 为一个影片

import flash.display.Sprite;
stage.addEventListener(MouseEvent.MOUSE_MOVE, onStageMouseMoveHandle);
function onStageMouseMoveHandle(evt:MouseEvent):void
{
if (gz.parent as Sprite)
{
var parentObj:Object=gz.parent; gz.rotation = 180 / Math.PI * Math.atan2(parentObj.mouseY - gz.y,parentObj.mouseX - gz.x);
}
}

源文件:https://files.cnblogs.com/files/dt1991/as3_%E6%A0%B9%E6%8D%AE%E9%BC%A0%E6%A0%87%E7%A7%BB%E5%8A%A8%E6%96%B9%E5%90%91.zip

上一篇:Luogu4652 CEOI2017 One-Way Streets 树上差分


下一篇:小tips:JS的Truthy和Falsy(真值与假值)