我的问题
Scene 1, Layer 'Layer 19', Frame 1, Line 23 1061: Call to a possibly undefined method addEventListener through a reference with static type Boolean.
Scene 1, Layer 'Layer 19', Frame 1, Line 28 1061: Call to a possibly undefined method addEventListener through a reference with static type Boolean.
Scene 1, Layer 'Layer 19', Frame 1, Line 33 1061: Call to a possibly undefined method addEventListener through a reference with static type Boolean.
Scene 1, Layer 'Layer 19', Frame 1, Line 38 1061: Call to a possibly undefined method addEventListener through a reference with static type Boolean.
我的代码很好直到我在帧之间添加一个迷你按钮,因为我找不到一个教程之间的编码。有人说我需要把它放在一个新的层。我卡住了自己。请帮忙!
stop();
header_mc.home_btn.addEventListener(MouseEvent.CLICK, gohome);
header_mc.logo_btn.addEventListener(MouseEvent.CLICK, gohome);
function gohome (event:MouseEvent):void{
gotoAndStop(1)
}
header_mc.about_btn.addEventListener(MouseEvent.CLICK, goabout);
function goabout (event:MouseEvent):void{
gotoAndStop(2)
}
header_mc.image_btn.addEventListener(MouseEvent.CLICK, goimage);
function goimage (event:MouseEvent):void{
gotoAndStop(3)
}
////////Button 1//////////
thumb1_btn.enabled=true.addEventListener(MouseEvent.CLICK, GetFirstImage)
function GetFirstImage (event:MouseEvent):void{
gotoAndStop(4)
}
////////Button 2//////////
thumb2_btn.enabled=true.addEventListener(MouseEvent.CLICK, GetSecondImage)
function GetSecondImage (event:MouseEvent):void{
gotoAndStop(5)
}
////////Button 3//////////
thumb3_btn.enabled=true.addEventListener(MouseEvent.CLICK, GetThirdImage)
function GetThirdImage (event:MouseEvent):void{
gotoAndStop(7)
}
////////Button 4//////////
thumb4_btn.enabled=true.addEventListener(MouseEvent.CLICK, GetForthImage)
function GetForthImage (event:MouseEvent):void{
gotoAndStop(6)
}
header_mc.contact_btn.addEventListener(MouseEvent.CLICK, gocontact);
function gocontact (event:MouseEvent):void{
gotoAndStop(7)
}
header_mc.demo_btn.addEventListener(MouseEvent.CLICK, godemo);
function godemo (event:MouseEvent):void{
gotoAndStop(8)
}
答案 0 :(得分:1)
可能,您想要实现的目标是:
thumb4_btn.enabled=true.addEventListener(MouseEvent.CLICK, gocontact)
不
(p,x,y,z)
只有实现IEventDispatcher的对象才有addEventListener方法