我收到此錯誤:如何修復AS3 TypeError:錯誤#1009:無法訪問空對象引用的屬性或方法?
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Skool_fla::MainTimeline/frame1()[Skool_fla.MainTimeline::frame1:10]
at flash.display::MovieClip/gotoAndStop()
at Skool_fla::MainTimeline/goback()[Skool_fla.MainTimeline::frame2:22]
是什麼原因造成這個錯誤,我該如何解決?
這是我的兩個幀代碼:
的第1幀:這是主菜單屏幕,您可以訪問信貸部分
import flash.events.MouseEvent;
//setting up the variables
//events
//stop the timeline
stop();
//the play button
play_btn.addEventListener(MouseEvent.CLICK, playani);
function playani(e:MouseEvent)
{
//asking it to progress to the load menu
gotoAndStop(3);
}
//the credits button
credit_btn.addEventListener(MouseEvent.CLICK, creditslide);
function creditslide(e:MouseEvent)
{
//asking it to go the credits frame
gotoAndStop(2);
}
幀2:這是在信貸出現
//
//
//all the imports
//events
var credit:credits_bck = new credits_bck();
var credits_name: credit_nm = new credit_nm();
var back_butn: back_button = new back_button();
addChild (credit);
addChild (credits_name);
addChild (back_butn);
back_butn.addEventListener(MouseEvent.CLICK,goback);
function goback(G:MouseEvent)
{
removeChild (credit);
removeChild (credits_name);
gotoAndStop(1);
}
什麼是你的問題? – Madbreaks
以及我得到這個錯誤,爲什麼呢?以及如何修復它... – tailedmouse