2011-11-17 76 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加载时,构造函数类正在被调用。 –