2011-01-11 128 views
0

在單擊按鈕轉到另一個框架後,Flash發生此錯誤。在我收到錯誤信息後,有些按鈕不會到達目的地,而只是不做任何事情。AS3 --- TypeError:錯誤#1009:無法訪問空對象引用的屬性或方法

的錯誤如下:

TypeError: Error #1009: Cannot access a property or method of a null object reference. 
    at wmhssports_fla::MainTimeline/frame39() 

這裏是39幀代碼:

stop(); 

winter_btn.addEventListener(MouseEvent.CLICK, buttonClick1); 
function buttonClick1(event:MouseEvent):void{ 
gotoAndPlay(39); 
}; 

spring_btn_boys.addEventListener(MouseEvent.CLICK, buttonClick10); 
function buttonClick10(event:MouseEvent):void{ 
gotoAndPlay(114); 
}; 

fall_btn_boys.addEventListener(MouseEvent.CLICK, buttonClick11); 
function buttonClick11(event:MouseEvent):void{ 
gotoAndPlay(135); 
}; 
+1

框架39中定義了`winter_btn`,`spring_btn`和`fall_btn`嗎?嘗試'trace(fall_btn);`看看你得到了什麼。 – 2011-01-11 18:02:40

+0

我會看看這個文件。將其上傳到mediafire.com等服務,然後通過我網站上的聯繫表單發送鏈接(查看我的個人資料)。 – 2011-01-11 18:52:47

回答

3

我看了一下您的Flash影片/應用程序,以下是解決問題的方法:

.alt text

上面的影像是您的Flash影片/應用程序的時間線的截屏。在第39幀處,您收到錯誤「TypeError:Error#1009:無法訪問空對象引用的屬性或方法,位於wmhssports_fla :: MainTimeline/frame39()」。你收到這個,因爲那時你的spring_btn按鈕的實例spring_btn_girls爲空。爲了解決這個問題,你的spring_btn按鈕實例在框架34上的實例名稱爲「spring_btn_girls」。

0

一個你鏈接到不存在(例如錯字的按鈕名稱?)或不在您正在編碼的框架上。

正如約翰說的,嘗試trace(winter_btn, spring_btn, fall_btn);。返回null的那個是你想糾正的那個。

相關問題