Question

When I load it by Loader.load I can pass them via URLRequest. But I don't see any opportunity in case of Loader.loadBytes. This question is similar to Passing flashvars-style parameters to a loaded SWF.

Was it helpful?

Solution

The answer is in API documentation. I've been hinted at another site.

You should use parameters property of LoaderContext object which you pass to the Loader.loadBytes method. But it works only for the AS3 swfs. It seems to be imporsible for the AS1/2 swfs.

var swf:ByteArray = getSWF();//swf bytes from nowhere
var loader:Loader = new Loader()
var loaderContext:LoaderContext = new LoaderContext();
loaderContext.parameters = {a: "1", b: "2"};
loader.loadBytes(swf, loaderContext);

I think it's right answer for now.

OTHER TIPS

Great! runs for me only if parameters are strings:

loaderContext.parameters = {"a": "1", "b": "2"};
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top