2011-11-17 73 views

回答

0

如果您正在使用加載的SWF並希望它們使用舞臺,首先需要在舞臺上添加它們(不像默認的SWF出現在舞臺上)。

,所以你需要使用這樣的事情:

public function YOURCLASS() 
{ 
    // at this point if the swf is externally loaded, it is only in the memory 
    // but not on stage. you can "trace (stage)" it will give you NULL 

    // you need to listen to the event when the object was added on stage. 
    addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage); 
} 

private function handleAddedToStage(e:Event):void 
{ 
    removeEventListener(Event.ADDED_TO_STAGE, handleAddedToStage); 
    // now the object is added on the stage, and you can refer the stage parameter 
    // "trace (stage)" it will give you [Stage] 
} 

希望它幫助。

UPDATE

Theoreticaly應該有可能是這樣的:

從SWF文件,您需要創建一個SWC文件(這是解決方案的理論部分)

那麼你有一個的NewClass它擴展了Constructor類,你不會調用super();

...可是我還是不知道什麼是從SWF創建SWC的chanses ...

+0

可惜我不能編輯加載的SWF(理論上),所以我需要一種方法來還是附加。 –

+0

更新瞭解決方案的理論版本。通常當swf加載時,構造函數類正在被調用。 –