I am using flashvars to get some info. When im using LoaderInfo(this.root.loaderInfo).parameters from the main fla frame it works fine but how can I use it from withing a class?
Something like this -
public function display_user_info()
{
var keyStr:String;
var valueStr:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
valueStr = String(paramObj['user_name']);
}
I'm getting this error message: Access of possibly undefined property root through a reference with static type.
Hope someone could guide me how to overcome this. thanks!
Try this:
package {
import flash.display.Sprite;
public class Main extends Sprite {
public function Main() {
trace(this.loaderInfo.parameters.yourFlashVarName);
}
}
}
This is what's suggesting wvxvw:
package
{
import flash.display.MovieClip;
import flash.events.Event;
//
public class FlashvarsTest extends MovieClip
{
public function FlashvarsTest()
{
addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
}
public function addedToStageHandler(evt:Event)
{
trace(this.loaderInfo.parameters.yourFlashVarName);
}
}
}