1 Reply Latest reply on Apr 20, 2010 6:39 AM by kglad

    Loading XML data into Flash AS2, Please help!

    hardwindow123

      Hey,

      i was hoping someone could help me with this code. I'm trying to integrate a dynamic text field for a pre-existing gallery that runs off XML.  The problem is that the photo updates, but the comments do not.

       

      backImage.onLoad = function(success:Boolean) {
      if (success) {
        //get vars from XML file
         bgImages = [];
        comments = [];
        //reset the array var, should for some reason you want to load in a different set of images
        xmlNodes = this.firstChild;
        largeImages = xmlNodes.childNodes.length;
        //_root.comments = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
        comment_txt.text = comments;
       
        for (i=0; i<largeImages; i++) {
         bgImages[i] = xmlNodes.childNodes[i].childNodes[0].firstChild.nodeValue;
         comments[i] = xmlNodes.childNodes[i].childNodes[1].firstChild.nodeValue;
        }

        loadRandomBitmap();

       

      then later...

       

      function loadRandomBitmap():Void {

           info.info2.comment_txt.text = comments;

      }

       

      I think im having problems with the variable part of it, designating comments[i]= is not working.

       

      Any thoughts?

       

      _joseph