0
我有這個as3項目,並且在時間軸的一幀中,我嘗試加載一個名爲「menu」的swf電影,並在這個加載電影我有一個名爲「button1」的按鈕的實例,我想添加一個新的EventListener到這個「button1」。我的代碼是在這裏:as3錯誤:通過帶有靜態類型的引用訪問Possiblealy undefind屬性flash.display:DisplayObject
var theLoader:Loader = new Loader();
var address:URLRequest = new URLRequest("menu.swf");
theLoader.load(address);
theLoader.contentLoaderInfo.addEventListener(Event.COMPLETE , swfDidLoad);
function swfDidLoad(evt:Event){
if(theLoader.content){
addChild(theLoader);
var button:SimpleButton = theLoader.content.button1;
button.addEventListener(MouseEvent.CLICK, handler1);
}
}
function handler1 (event:MouseEvent):void
{
removeChild(theLoader);
gotoAndStop(10);
};
但我得到這個undefind屬性錯誤。我該怎麼辦?我做對了嗎?