TypeError: Error #1034: 强制转换类型失败:无法将 flash.events::MouseEvent@3ab9661 转换为 flash.ui.Mo
enemy_mc.addEventListener(MouseEvent.MOUSE_DOWN,PL1);functionPL1(event:Mouse):void{en...
enemy_mc.addEventListener(MouseEvent.MOUSE_DOWN,PL1);
function PL1(event:Mouse):void {
enemy_mc.addEventListener(Event.ENTER_FRAME,pl2);
function pl2(event:Mouse):void {
var myRadians:Number = Math.atan2(mouseY-enemy_mc.y, mouseX-enemy_mc.x);
var myDegrees:Number = Math.round((myRadians*180/Math.PI));
var biaoy:Number = Math.round(mouseY+1);
var biaox:Number = Math.round(mouseX+1);
enemy_mc.rotation = myDegrees;
enemy_mc.y += biaoy;
enemy_mc.X += biaox;
}
} 展开
function PL1(event:Mouse):void {
enemy_mc.addEventListener(Event.ENTER_FRAME,pl2);
function pl2(event:Mouse):void {
var myRadians:Number = Math.atan2(mouseY-enemy_mc.y, mouseX-enemy_mc.x);
var myDegrees:Number = Math.round((myRadians*180/Math.PI));
var biaoy:Number = Math.round(mouseY+1);
var biaox:Number = Math.round(mouseX+1);
enemy_mc.rotation = myDegrees;
enemy_mc.y += biaoy;
enemy_mc.X += biaox;
}
} 展开
展开全部
enemy_mc.addEventListener(MouseEvent.MOUSE_DOWN,PL1);
function PL1(event:Mouse):void
{
enemy_mc.removeEventListener(MouseEvent.MOUSE_DOWN,PL1);
enemy_mc.addEventListener(Event.ENTER_FRAME,pl2);
}
function pl2(event:Mouse):void
{
var myRadians:Number = Math.atan2(mouseY-enemy_mc.y, mouseX-enemy_mc.x);
var myDegrees:Number = Math.round((myRadians*180/Math.PI));
var biaoy:Number = Math.round(mouseY+1);
var biaox:Number = Math.round(mouseX+1);
enemy_mc.rotation = myDegrees;
enemy_mc.y += biaoy;
enemy_mc.X += biaox;
}
---------------------
结构改成这样比较合理点,你那句错误不是这里报出来的吧,因为这段代码里没有叫做“flash.ui.Mo”这个的类或者属性。
function PL1(event:Mouse):void
{
enemy_mc.removeEventListener(MouseEvent.MOUSE_DOWN,PL1);
enemy_mc.addEventListener(Event.ENTER_FRAME,pl2);
}
function pl2(event:Mouse):void
{
var myRadians:Number = Math.atan2(mouseY-enemy_mc.y, mouseX-enemy_mc.x);
var myDegrees:Number = Math.round((myRadians*180/Math.PI));
var biaoy:Number = Math.round(mouseY+1);
var biaox:Number = Math.round(mouseX+1);
enemy_mc.rotation = myDegrees;
enemy_mc.y += biaoy;
enemy_mc.X += biaox;
}
---------------------
结构改成这样比较合理点,你那句错误不是这里报出来的吧,因为这段代码里没有叫做“flash.ui.Mo”这个的类或者属性。
追问
呵呵我已经解决了 enemy_mc.addEventListener(Event.ENTER_FRAME,pl2);
function pl2(event:Mouse):void {
正确的是
enemy_mc.addEventListener(Event.ENTER_FRAME,pl2);
function pl2(event:Event):void {
是函数的管理问题。。。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询