使用此代码得到一个 Parameter child must be non-null 错误任何人都可以提供帮助吗?
for (i=1; i<=4; i++)
{
this["Box" + i].addEventListener(Event.ENTER_FRAME, Move);
this["Box" + i].addEventListener(MouseEvent.CLICK, Action);
}
function Move(e:Event):void
{
e.target.y -= 6;
if (e.target.y <= 56)
{
MovieClip(e.target).removeEventListener(Event.ENTER_FRAME, Move);
removeChild(getChildByName(e.target.name));
Comment.text = "MISS";
miss += 1;
score += 0;
}
}
function Action(event:MouseEvent):void
{
if ((event.target.hitTestObject(bts1))&&(event.target.hitTestObject(bts2))&&(event.target.hitTestObject(bts3))&&(event.target.hitTestObject(bts4)))
{
MovieClip(event.target).removeEventListener(MouseEvent.CLICK, Action);
removeChild(getChildByName(event.target.name));
Comment.text = "PERFECT";
perfect += 1;
score += 10000;
}
else if ((event.target.hitTestObject(bts2)&&event.target.hitTestObject(bts3)&&event.target.hitTestObject(bts4))||(event.target.hitTestObject(bts1)&&event.target.hitTestObject(bts2)&&event.target.hitTestObject(bts3)))
{
MovieClip(event.target).removeEventListener(MouseEvent.CLICK, Action);
removeChild(getChildByName(event.target.name));
Comment.text = "GREAT";
great += 1;
score += 5000;
}
else if ((event.target.hitTestObject(bts3)&&event.target.hitTestObject(bts4))||(event.target.hitTestObject(bts1)&&event.target.hitTestObject(bts2)))
{
MovieClip(event.target).removeEventListener(MouseEvent.CLICK, Action);
removeChild(getChildByName(event.target.name));
Comment.text = "GOOD";
good += 1;
score += 2500;
}
else if ((event.target.hitTestObject(bts4))||(event.target.hitTestObject(bts1)))
{
MovieClip(event.target).removeEventListener(MouseEvent.CLICK, Action);
removeChild(getChildByName(event.target.name));
Comment.text = "BOO";
boo += 1;
score += 1000;
}
else
{
MovieClip(event.target).removeEventListener(MouseEvent.CLICK, Action);
removeChild(getChildByName(event.target.name));
Comment.text = "MISS";
miss += 1;
score += 0;
}
}
顺便说一句,“bts1,2,3”是一个行影片剪辑,问题发生在鼠标单击事件上,我想要的是当我单击框时,它将对“bts”进行命中测试,并且该框将在用户之后被删除点击,如果用户没有点击,那么它会在某个点消失