0 Replies Latest reply on Mar 29, 2007 8:27 AM by sundeep_02tv26

    xml images looping?

    sundeep_02tv26

      hai to all
      i am in a problem that is, i did a backgorund image changer for 10 secs for my project. the code below works fine. all well but what i need is after compeleting all the images in the xml file it stops.

      i want it to loop or repeat the process again can any say how plzzz

      this is my code:-
      xmlData = new XML ();
      xmlData.ignoreWhite = true;
      xmlData.onLoad = loadXML;
      xmlData.load ("images.xml");
      function loadXML (loaded) {
      if (loaded) {
      xmlNode = this.firstChild;
      image = [];
      total = xmlNode.childNodes.length;
      for (i=0; i<total; i++) {
      image = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
      //trace (image );
      }
      firstImage ();
      }
      else {
      trace ("file not loaded!");
      }
      }
      p = 0;
      filesize = picture.getBytesTotal ();
      loaded = picture.getBytesLoaded ();
      function firstImage () {
      if (loaded == filesize) {
      picture.loadMovie (image[0], 1);
      picture._alpha = 100;
      alpha (picture);
      effect (picture);
      timer ();
      }
      }
      function nextImage () {
      if (p<(total-1)) {
      p++;
      if (loaded == filesize) {
      picture.loadMovie (image[p], 1);
      picture._alpha = 100;
      alpha (picture);
      //removeMovieClip("effect1");
      effect (picture);
      timer ();
      }
      }
      }
      /*function prevImage () {
      if (p>(total-1)) {
      p--;
      picture.loadMovie (image[p], 1);
      picture._alpha = 100;
      timer ();
      }
      }*/
      function timer () {
      var secs = 10;
      var id = setInterval (function () {
      clearInterval (id);
      nextImage ();
      }, secs*1000);
      }
      var alpha_interval = setInterval (alpha, 100, picture);
      function alpha (picture) {
      picture._alpha += 10;
      if (picture._alpha<100) {
      trace ("alpha");
      clearInterval (alpha_interval);
      }
      }
      function effect (picture) {
      this.attachMovie ("effect", "effect1", 10);
      }