Domanda

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.

È stato utile?

Soluzione

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.

Altri suggerimenti

Great! runs for me only if parameters are strings:

loaderContext.parameters = {"a": "1", "b": "2"};
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top