4 Replies Latest reply on Jun 23, 2007 2:20 PM by kglad

    scope question

    Level 7
      I am loading xml document into my Flash file and would like to be able
      to trace the xnRoot variable later on in a function. I have the
      following, but my trace in the pageBuild function is returning
      undefined. How do I do this right? This is a scope issue, right?


      var xmlImages:XML = new XML();
      xmlImages.ignoreWhite = true;
      xmlImages.onLoad = function(bSuccess:Boolean):Void{
      if(bSuccess){
      var xnRoot:XMLNode = this.firstChild;
      pageBuild();
      }
      };
      xmlImages.load("indeximages.xml");


      function pageBuild():Void{
      for(var i:Number = 0; i < numOfImages; i++){
      trace("the root one is: \n" + xnRoot.childNodes[0]);
      }
      }


      Thank you for any help!