【发布时间】:2018-06-29 12:06:55
【问题描述】:
我正在使用 swfloader 在主 swf 中加载一个 swf 文件,并且我想将参数传递给加载的 swf。如何获取加载的子引用以传递数据。 我的示例代码如下
TestFile1.mxml
public var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, myFun);
loader.load(new URLRequest("/view/flex/TestFile2.swf"), new LoaderContext(false, ApplicationDomain.currentDomain));
viewId.addChild(loader);
public function myFun(event:Event):void{
Alert.show("loader.content-"+loader.content); // here alert coming like this [object_TestFile2_mx_managers_SystemManager]
var testfile2:TestFile2 = loader.content as TestFile2; // here testfile2 is null
testfile2.param1 = "val1";
}
【问题讨论】:
标签: actionscript-3 apache-flex mxml