Skip to main content
January 20, 2018
Question

pass data to child swf after swf loading completed

  • January 20, 2018
  • 1 reply
  • 266 views

I am loading one swf file inside a main swf by using swfloader and i want to pass the parameters to the loaded swf. How can i get the loaded child reference to pass data. My sample code is as follows

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";
}

This topic has been closed for replies.

1 reply

jeromiec83223024
Inspiring
January 24, 2018