1
votes

In my application I read a XML file containing binary data representing a SWF file. I'm able then to display that SWF using a SWFLoader component and setting its 'source' property to the ByteArray I got from the XML file.

It's working nice but now I need to pass some parameters to the loaded SWF...How can I do that?

The code to load the SWF is as follows:

var loaderContext:LoaderContext = new LoaderContext();
loaderContext.allowLoadBytesCodeExecution = true;

var loader:SWFLoader = new SWFLoader();             
loader.loaderContext = loaderContext;
loader.width = 300;
loader.height = 300;
loader.source = bytes; // bytes is the ByteArray

this.addElement(loader);
1

1 Answers

2
votes

Use parameters object in loaderContext :

var loaderContext:LoaderContext = new LoaderContext();
loaderContext.allowLoadBytesCodeExecution = true;
loaderContext.parameters = {key:"value"};

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/LoaderContext.html#parameters