URLLoader event timing
I'm having an issue getting URLLoader to work the way I want. I basically need to pull information from xml files, parse that information into objects, and then work with said objects afterwards.
Here's pseudocode for my current implementation (which does not work)
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, loadXML);
xmlLoader.load(new URLRequest("xml1.xml"));
xmlLoader.load(new URLRequest("xml2.xml"));
function loadXML(e:Event): void {
process xml data into objects
}
do stuff with objects
When the debugger runs, the do stuff with objects portion runs first. Is there a way for me to make this work without spaghettifying my code?