I use flashvars heavily to create customizable swfs. After some time I got tired of copy pasting my code and found this:
[as3]
function getFlashVars():Object {
return Object(LoaderInfo(this.loaderInfo).parameters);
}
[/as3]
I only need to call this method (which returns an object) and chain it with the flashvar I want. This only works on timeline code though.
Here’s how I use it:
[as3]
strXMLPath = getFlashVars().xmlPath || "slideshow.xml";
[/as3]
The || is for error handling. If I can’t get the flashvar:xmlPath, I created a default file slideshow.xml to show default data.