views:

27

answers:

1

What's the best way to pass a predefined argument to flash?

A: 

Pass it as name-value pairs in the SWF's URL.

"mymovie.swf?defColor=blue&stage=3"

and read it from the loaderInfo.parameters property of the root movie clip - the one with the document class.

var params:Object = root.loaderInfo.parameters;
//or this.loaderInfo.parameters if you're calling from the document class.
trace(params.defColor); // dot sytax and
trace(params["stage"]); // []  syntax works.
Amarghosh
Is `root` available in as2 ?
wamp
@wamp `root` is `_root` in AS2, but that's a little different from the AS3 root concept I believe. I am not sure if it has `loaderInfo` property either.
Amarghosh
@Amarghosh,I just verified that it's not available in `as2`
wamp