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