TwelvestoneFlash

return from onLoad?


Sign in

  • Waiting for Godot ( 720 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 4.8 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.8 k posts )
    general front end design an...
  • Back End ( 9.6 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
the real me
 
2007-12-19

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?
    }
}
jamiec
 
2007-12-19

I usually make my data object a member of the class, therefore populating it in the onload.

var myDataObjectkataObject = 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.

the real me
 
2007-12-19

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!

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

return from onLoad?