Does any know how to load a XML into a Flash file using FlashVar?
I have these lines that load my XML data from a folder called XML
var url:String = "xml/TEST.xml";
var req:URLRequest = new URLRequest(url);
var uLdr:URLLoader = new URLLoader();
uLdr.addEventListener(Event.COMPLETE, completeHandler);
uLdr.load(req);
I would like to use FlashVar to enter the "xml/TEST.xml"; portion so I can keep reusing the SWF file and only have to enter a FlashVar in the HTML to point to the data. I have some users that are not Flash programmers and it would be easy for them to past the HTML and only have to change the FlashVar line to point to their XML file, as opposed to having to get me to hardcode it everytime.
Any ideas??
You should be able to do something along these lines. Pay attention to the loaderInfo.parameters part.
var url:String = LoaderInfo(this.root.loaderInfo).parameters['xmlURL'];
var req:URLRequest = new URLRequest(url);
var uLdr:URLLoader = new URLLoader();
uLdr.addEventListener(Event.COMPLETE, completeHandler);
uLdr.load(req);
For More Info See: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/LoaderInfo.html#parameters