1
我無法通過外部swf加載forces.swf(假設我無法編輯它,因爲我沒有源代碼)基類。加載外部SWF帶階段引用
我會如何加載它(和任何其他可能的SWF)而不會引發錯誤?
這是解決問題的鏈接我試圖修復:
http://www.mediafire.com/?9d9qay8a6xj7836
感謝。
我無法通過外部swf加載forces.swf(假設我無法編輯它,因爲我沒有源代碼)基類。加載外部SWF帶階段引用
我會如何加載它(和任何其他可能的SWF)而不會引發錯誤?
這是解決問題的鏈接我試圖修復:
http://www.mediafire.com/?9d9qay8a6xj7836
感謝。
如果您正在使用加載的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 ...
可惜我不能編輯加載的SWF(理論上),所以我需要一種方法來還是附加。 –
更新瞭解決方案的理論版本。通常當swf加載時,構造函數類正在被調用。 –