I set up a simple dynamic text on my stage.
I want to use the flashvars approach:
var keyStr:String;
var valueStr:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters; //set the paramObj variable to the parameters property of the LoaderInfo object
for (keyStr in paramObj) // I only have one parameter to load
{
valueStr = String(paramObj[keyStr]);
}
But what happens now, is:
How do I load this valueStr to my myText.text ?
It is not initialized yet…
Thanks!
Add an event listener for Event.COMPLETE on your loaderInfo object, so you know when your swf is fully loaded, and therefore all of it’s properties are properly initialized/ready:
Note that you can not have too much data in your flashVars, but you could pass an url to a text file that could hold more. In the example bellow if a flashVar named
testFilepoints to a text file, that is then loaded and appended tomyText.