2016-10-07 12 views
0

我的問題是說我是FlashCS6的初學者。編碼的ActionScript

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) 
} 

回答

1

可能,你想達到什麼是:

thumb4_btn.addEventListener(MouseEvent.CLICK, gocontact); 

thumb4_btn.enabled=true.addEventListener(MouseEvent.CLICK, gocontact) 

只有實現實現IEventDispatcher對象具有addEventListener方法

+0

如果'enabled'屬性應該是除了調用函數外,還應該在單獨的行上進行設置。 – null