i have an xml parser class that is building an object. i'm stuck on how to return that object though since it is being populated in the onLoad function? basically something like this
function getArticle() {
articleXML = new XML();
articleXML.ignoreWhite = true;
articleXML.onLoad = Delegate.create(this, onLoadEvent);
articleXML.load(xmlloc);
}
function onLoadEvent(success:Boolean) {
if (success) {
// get data and stuff here
// populate my object below here...
article.setHeadingTxt(heading_txt);
// so how do i return my article object here?
}
}
I usually make my data object a member of the class, therefore populating it in the onload.
var myDataObject
ataObject = null;
function getDataObjectFromXml() { // blah blah }
function parseData() { this.myDataObject = new DataObject() this.myDataObject.someProp = xml.attributes["someProp"]; }
After the data is parsed the object is available to any other method. I often broadcast an event to let evrything else know the data object is loaded up.
ok cool, my data object is a member of the class. i just didn't think to broadcast that it was populated as opposed to trying to return it. i think that will solve it all.
thanks!