I want to access some flashvars in my preloader to a Flex application. How is this possible?
Regards Adlertz
From stackoverflow
-
Try the
loaderInfo.parameters
attribute of the preloader. -
From the preloader, you should be able to access the flashvars indirectly through the SystemManager as follows:
var systemManager:SystemManager = parent.parent as SystemManager; var params:Object = LoaderInfo(systemManager.loaderInfo).parameters;
David Hanak : I think the loaderInfo attribute of all sprites in the display tree point to the same LoaderInfo instance, so there is no need to dig up the system manager. But I could be wrong. -
I have accessed the flashvars using loaderinfo from the root of my preloader-sprite.
var flashvars:Object = root.loaderInfo.parameters;
The tricky part was to know when the root wasn't null. But I found a blogpost:
http://dndigital.net/blog/2008/08/accessing-flashvars-in-a-custom-flex-preloader/
David Hanak : root.loaderInfo is the same as loaderInfo, when root is not null, see my comment to Raul's answer.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.