5 Replies Latest reply on Jan 19, 2007 11:11 PM by kglad

    Please help xml and actionscript

    indianANGEL
      Hi there,

      I am newbie with xml and actionscript stuff. I am building a slideshow with the help of an online tutorial. The image path is stored in an xml file. My .as code does grab the image path, but only displays the last image. I figured this out because I did Debug Movie and it show only the last image.
      Any ideas?

      Also I need help adding timing between each image. It would be nice if someone can guide me through that process.

      Thanks!
      Sue

      Here is part of my code:

      function updateSlide(newSlideNode){
      imagePath = newSlideNode.attributes.jpegURL;
      this.createEmptyMovieClip("myHolder", 1);
      myHolder.loadMovie(imagePath, targetClip);
      nextSlideXML();
      }

      function nextSlideXML(){
      nextSlideNode = currentSlideNode.nextSibling;
      trace("Current Slide: " +currentSlideNode);
      if(nextSlideNode == null){
      break;
      }
      else{
      currentIndex ++;
      currentSlideNode = nextSlideNode;
      updateSlide(nextSlideNode);

      }
      }
        • 1. Re: Please help xml and actionscript
          kglad Adobe Community Professional & MVP
          well, it looks like you've set-up a loop that starts with updateSlide(), goes to nextSlideXML() and then loops back to updateSlide(). so, you're looping though all your slides before the first one (and all the rest except the last) complete loading.

          to remedy, don't call nextSlideXML() until your loadMovie() has completed (use preloader code) AND that image has displayed, at least, a perceptible amount of time (use setInterval() ).
          • 2. Re: Please help xml and actionscript
            indianANGEL Level 1
            Here is what my three function looks like:

            function loadImages(){
            rootSlides = slideshowXML.firstChild;
            totalSlides = rootSlides.childNodes.length;
            firstSlideNode = rootSlides.firstChild;
            currentSlideNode = firstSlideNode;
            currentIndex = 1;
            updateSlide(firstSlideNode);
            }

            function updateSlide(newSlideNode){
            imagePath = newSlideNode.attributes.jpegURL;
            trace(myHolder);
            myHolder.loadMovie(imagePath);
            nextSlideXML();

            }

            function nextSlideXML(){
            nextSlideNode = currentSlideNode.nextSibling;
            trace("Current Slide: " +currentSlideNode);
            if(nextSlideNode == null){
            break;
            }
            else{
            currentIndex ++;
            currentSlideNode = nextSlideNode;
            updateSlide(nextSlideNode);
            }
            }
            ------------------------------------------

            So the loadImages() calls the updateSlide(), it should load my first image and then calls the nextSlideXML() and loops back and forth until the last image is loaded.

            • 3. Re: Please help xml and actionscript
              kglad Adobe Community Professional & MVP
              your last paragraph is correct except your first image never loads. there's not enough time between execution of your loadMovie() statement and the next loadMovie() statement for anything to load, EXCEPT your last image (because there is no next image).
              • 4. Re: Please help xml and actionscript
                indianANGEL Level 1
                Thank you so much... Really appreciate your help.

                SetInterval() did the trick.

                Also can you help me understand how to do the Alpha transition between images. I want to blur the image out before loading the next image, for a smooth transition.

                Thanks!
                • 5. Re: Please help xml and actionscript
                  kglad Adobe Community Professional & MVP
                  then you'll need, at least, 2 target movieclips. you'll load an image into the first target and the next image into the 2nd target. set the 2nd target's _alpha to zero at load start. when loading is complete and your 1st image has displayed long enough, fade out your 1st and fade in your 2nd.

                  when fadeout of the 1st is complete load the next image into it. when loading is complete and your 2nd image has displayed long enough, fade out the 2nd and fade in the 3rd etc.