0 Replies Latest reply on Oct 11, 2006 5:58 AM by Newsgroup_User

    XML handling and duplicated mc's

    Level 7
      Hi,

      I building a website with a kind of slide show for my local r/c club. The
      first time the mc starts, it reads a (for now static) XML file that contains
      all info needed for the pics in the slide show. On the first cycle, the
      information on the pics is read correctly but not completely. The images are
      shown as linked from the XML, but the comment below the image is not. The mc
      delays some time (test timer added), removes all existing duplicated mc's
      and then reloads the XML and recreates new images. On the subsequent cycles
      the info is shown correctly. Why is this?

      Also, is there a way to detect if the image is fully loaded to prevent a
      blank image whilst loading from the server. So I can display the mc after
      it's complete with text and image.



      Action Script used:

      pixml = new XML();
      pixml.ignoreWhite = true;
      pixml.onLoad = ScatterPics;
      pixml.load("hoei.xml");

      function ScatterPics(success) {
      if(success == true) {
      rootNode = pixml.firstChild;
      totalSlides = rootNode.childNodes.length;
      firstSlideNode = rootNode.firstChild;
      currentSlideNode = firstSlideNode;
      for(i = 1; i < totalSlides; i++) {
      if(currentSlideNode == null) {
      break;
      } else {
      CloneBasePic(currentSlideNode);
      nextSlideNode = currentSlideNode.nextSibling;
      currentSlideNode = nextSlideNode;
      }
      }
      }
      }

      function CloneBasePic(anyNode) {
      duplicateMovieClip(mcPicbron, "mcPic"+i, 1+random(150));
      setProperty("mcPic"+i, _x, random(900)-100);
      setProperty("mcPic"+i, _y, random(500)-100);
      setProperty("mcPic"+i, _rotation, random(30)-15);
      loadMovie(anyNode.attributes["image"], eval("mcPic"+i).picImage);
      eval("mcPic"+i).picImage._width = 240;
      eval("mcPic"+i).picImage._height = 180;
      eval("mcPic"+i).txtSub.htmlText = "<font
      size=\"10\">"+anyNode.attributes["date"]+":</font><br>"+anyNode.attributes["comment"];
      }


      The XML looks like this:

      <?xml version="1.0" encoding="iso-8859-1"?>
      <imglist>
      <pic image="/img/slide01.jpg" width="240" height="180" date="08-10-2006"
      comment="30 Personen en 17 auto's" />
      <pic image="/img/slide02.jpg" width="240" height="180" date="08-10-2006"
      comment="Bigfoot doet Big Air's" />
      <pic image="/img/slide03.jpg" width="240" height="180" date="08-10-2006"
      comment="Te land, ter zee, en in de lucht" />
      <pic image="/img/slide04.jpg" width="240" height="180" date="30-09-2006"
      comment="Uitzetten van de eerste echte baan" />
      <pic image="/img/slide05.jpg" width="240" height="180" date="30-09-2006"
      comment="Doorwerken tot in de avonduren" />
      <pic image="/img/testbeeld.jpg" width="240" height="180" date="11-10-2006"
      comment="Er wordt hard gewerkt aan deze website." />
      </imglist>

      The actual website is at www.offroaders.nl - under construction ;)