0 Replies Latest reply on Oct 3, 2006 8:20 AM by BuzzF

    storing variables out of xml parsing loop

    BuzzF
      hi guys

      I'm parsing xml data in flash, here is some example code:

      var file:XML = new XML();
      file.ignoreWhite = true;
      file.load("test.xml");
      file.onLoad = function(bSuccess:Boolean) {
      if (bSuccess) {
      var banana:String = this.childNodes[0].childNodes[0].childNodes;
      }
      }

      if i do a trace(banana) from inside the loop, the text is displayed,

      however if i do a trace(banana) command outside of the xml loop the result is undefined.
      How can i store information into variables that are then accessible outside of the xml parsing loop?

      I'm guessing i'm getting confused over variable scope or something, thanks for all your responses, they're really helpful.