AS3 Flash Vars

Tuesday, September 1, 2009

it's nothing new, I just keep forgetting how to do it. So here it is so I will never have to look it up again!


import flash.display.LoaderInfo;
try {
var allFlashVars:Object = LoaderInfo(this.root.loaderInfo).parameters;
img_path = String(allFlashVars["path"]);

if (img_path.toString() == String(undefined)){
throw new Error("FlashVars did not load");
}
}catch(e:Error){
//error_txt.text = "did not load flash vars";
img_path = "path_to_my_image.jpg";
}

0 comments:

Post a Comment