您的位置:首页 > 家居用品 > 家纺 > 实例AS3.0练习:根据鼠标光标所在坐标求取角度

实例AS3.0练习:根据鼠标光标所在坐标求取角度

luyued 发布于 2011-02-09 23:43   浏览 N 次  
说明:使用Math对象的atan2方法求出鼠标光标所在位置的角度,动态改变对象的旋转位置。
源码:
this.parent.addEventListener("mouseMove",car_move);
function car_move(me:MouseEvent){
var positionX=this.mouseX-car_mc.x;
var positionY=this.mouseY-car_mc.y;
var Radin=Math.atan2(positionY,positionX);
Radin=Radin/(Math.PI/180);
car_mc.rotation=Radin;
}截图:
--
芦笛Kevin.Reed.Lu电话:010-6556-0163手机:156-5223-9440传真:010-80115555-765910飞信:2010-00-910信箱:10010910@163.com抄送:910@37163.cnGtalk:765910@gmail.comMSN:Reed.lu@msn.comQQ:114-9966-910 UC:800-56205This message and any attachments may be privileged, confidential and intended for the addressee(s) or an authorized representative only. If you are not the intended recipient, please be notified that any dissemination, distribution, or copying of this e-mail, parts of it or contained information by any other person is strictly prohibited. If you have received this message in error, please delete it and notify Tevia.Aisa Limited. Our company accepts no liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Our company retains the copyright to all e-mail messages sent from its communications systems.

图文资讯
广告赞助商