Locked

pass data to child swf after swf loading completed

New Here ,
Jan 20, 2018 Jan 20, 2018

Copy link to clipboard

Copied

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

Views

183

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 24, 2018 Jan 24, 2018

Copy link to clipboard

Copied

LATEST

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines