Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

Great! runs for me only if parameters are strings:

loaderContext.parameters = {"a": "1", "b": "2"};
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top