1 Reply Latest reply on Apr 19, 2010 9:50 AM by kglad

    Small XML Problem

    d0brin Level 1

      I am making an Image Slider. I want to have 5 images but now i am testing it only with 2 images... my problem is in the loading the images from the XML files. Here is what i have on frame 1 to load me the images when on the stage i have 2 empty movie clips named img1 and img2

       

      var myXML = new XML();

      var im: MovieClip = this;


      myXML.ignoreWhite = true;

      myXML.onLoad = parseXML;


      function parseXML(){

          for(

      var i:Number=0;

      i<this.firstChild.childNodes.length;i++

      )

      {

         loadMovie(this.childNodes[i].firstChild.firstChild.nodeValue, im["img"+(i+1)]);

        }

      }

      myXML.load("h_images.xml");

       

      And my XMl is structured:

       

      <?xml version="1.0" encoding="utf-8"?>

      <myImage>

      <image1>h_images/white.jpg</image1>

      <image2>h_images/red.jpg</image2>

      </myImage>

       

      What happens is that only the first image is being loaded and for the second flash gives me the error:

       

      Error opening URL 'file:///D|/Web%20Design%20Projects/AINSim%20v3/flash/undefined'

       

      It doesn't find the next image... can you help me fix my problem?

        • 1. Re: Small XML Problem
          kglad Adobe Community Professional & MVP

          try:

           


           

          var myXML = new XML();

          var im: MovieClip = this;


          myXML.ignoreWhite = true;

          myXML.onLoad = parseXML;


          function parseXML(){

              for(

          var i:Number=0;

          i<this.firstChild.childNodes.length;i++

          )

          {

             loadMovie(this.childNodes[i].firstChild.nodeValue, im["img"+(i+1)]);

            }

          }

          myXML.load("h_images.xml");