3 Replies Latest reply on Jan 8, 2010 9:35 AM by kglad

    XML Slideshow problem

    TeamCIT

      Hello
      I'm new to this website and am very new at actionscript. I'm trying to make a fading slideshow in flash that loads images from a linked XML file. Each picture is suppose to fade in to each other. Everything is working except for a white flash or blink before each picture, I would really like to remove this blink if possible. I have copied and pasted the code I am using below, any help figuring out or improving the code would be much appreciated.

       

      Here is the code:

      function loadXML(loaded) {
          if (loaded) {
              xmlNode = this.firstChild;
              image = [];
              total = xmlNode.childNodes.length;
              for (i=0; i<total; i++) {
                  image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
              }   
              firstImage();
          } else {
              content = "cannot load file";
          }
      }
      xmlData = new XML();
      xmlData.ignoreWhite = true;
      xmlData.onLoad = loadXML;
      xmlData.load(_root.XMLName);

       

      p = 0;
      this.onEnterFrame = function() {
          filesize = picture.getBytesTotal();
          loaded = picture.getBytesLoaded();
          if (picture._alpha<100) {
                  picture._alpha += 10;
              }
      };
      //goes to the next image
      function nextImage() {
              p++;
              if (loaded == filesize) {
                  picture2.loadMovie(image[(p-1)], 1);
                  picture._alpha = 0;
                  picture.loadMovie(image[p], 1);
                  slideshow();
              }
      }

       

      //the first image
      function firstImage() {
          if (loaded == filesize) {
              picture2.loadMovie(image[(total-1)],1);
              picture._alpha = 0;
              picture.loadMovie(image[0],1);
              slideshow();
          }
      }

       

      //makes the slideshow change slides
      function slideshow()
      {
          function pause_slideshow()
          {
              clearInterval(myInterval);
              if (p == total - 1)
              {
                  p = 0;
                  firstImage();
              }
              else
              {
                  nextImage();
              }
          }
          myInterval = setInterval(pause_slideshow, 4000);
      }