Hello!
I have created a class named XMLclass and inside that class there is a function named returnFillColor.
The function looks like this:
public function returnFillColor(XMLchild:uint):String{
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.load(new URLRequest(xmlURL));
xmlData = new XML(xmlLoader.data);
XML.ignoreWhitespace = true
return xmlData.Thing[XMLchild].color;
}
When i call this function from my main class, it returns nothing because the XML wasn’t done loading. I’ve double-checked this by adding addEventListener(Event.COMPLETE) outside the function.
So my question is!
Is there any way to return data from the xml-file with just one function?
(like adding event.Complete to the returnFillColor-function)
Really grateful for answer!
~Tompa