请各位flash大侠帮忙看看这段代码 为什么老是TypeError: Error #1034: 强制转换类型失败:无法将 flash.eve

varbeta:Number=Math.PI/3;vartheta:Number=.5;varpressing:Boolean=newBoolean(false);var... var beta:Number=Math.PI/3;
var theta:Number=.5;
var pressing:Boolean=new Boolean(false);
var oldx:Number,oldy:Number;
var points:Array=new Array(8);
var mc:Sprite=new Sprite();
mc.x=100;
mc.y=120;
addChild(mc);
loadObject("cube");
bg_mc.addEventListener(MouseEvent.MOUSE_DOWN,dragMouse);
bg_mc.addEventListener(MouseEvent.MOUSE_UP,dropMouse);
addEventListener(Event.ENTER_FRAME,adjustDrag);
bt_cube.addEventListener(MouseEvent.MOUSE_DOWN,showCube);
bt_trapezia.addEventListener(MouseEvent.MOUSE_DOWN,showTrapezia);
bt_pyramid.addEventListener(MouseEvent.MOUSE_DOWN,showPyramid);
function showCube(e:MouseEvent) {
loadObject("cube");
}
function showTrapezia(e:MouseEvent) {
loadObject("trapezia");
}
function showPyramid(e:MouseEvent) {
loadObject("pyramid");
}
function loadObject(type:String) {
switch (type) {
case "cube" :
points[0]=new ThreeDpoint(-30,30,30);
points[1]=new ThreeDpoint(30,30,30);
points[2]=new ThreeDpoint(30,-30,30);
points[3]=new ThreeDpoint(-30,-30,30);
break;
case "trapezia" :
points[0]=new ThreeDpoint(-20,20,30);
points[1]=new ThreeDpoint(20,20,30);
points[2]=new ThreeDpoint(20,-20,30);
points[3]=new ThreeDpoint(-20,-20,30);
break;
case "pyramid" :
points[0]=new ThreeDpoint(0,0,30);
points[1]=new ThreeDpoint(0,0,30);
points[2]=new ThreeDpoint(0,0,30);
points[3]=new ThreeDpoint(0,0,30);
break;
}

points[4]=new ThreeDpoint(-30,30,-30);
points[5]=new ThreeDpoint(30,30,-30);
points[6]=new ThreeDpoint(30,-30,-30);
points[7]=new ThreeDpoint(-30,-30,-30);
}
function dragMouse(e:MouseEvent) {
pressing=true;
oldx=mouseX;
oldy=mouseY;
}
function dropMouse(e:MouseEvent) {
pressing=false;

}
function adjustDrag(e:MouseEvent) {
if (pressing==false) {
return;
}

var newx=mouseX;
var newy=mouseY;
var xLength=newx-oldx;
var yLength=newx-oldy;
var distance=Math.sqrt(xLength*xLength+yLength*yLength);
theta=distance=20;
oldx=newx;
oldy=newy;
if (theta==0) {
return;
}
beta=Math.acos(xLength/distance);
if (yLength<0) {
beta=- beta;
}

beta+=Math.PI/2;
}
输出面板:TypeError: Error #1034: 强制转换类型失败:无法将 flash.events::Event@dbfb0d1 转换为 flash.events.MouseEvent。
展开
 我来答
百度网友e246de7
2011-03-10 · TA获得超过144个赞
知道小有建树答主
回答量:88
采纳率:80%
帮助的人:140万
展开全部
addEventListener(Event.ENTER_FRAME,adjustDrag);
传递的事件类型要一致啊,所以下面这个函数的参数错了
function adjustDrag(e:MouseEvent)
应该是
function adjustDrag(e:Event)
czezc
2011-03-10 · TA获得超过581个赞
知道小有建树答主
回答量:834
采纳率:0%
帮助的人:782万
展开全部
function loadObject(type:String) {
参数中的类型有误吧!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式