2 Replies Latest reply on Sep 29, 2006 12:12 PM by respondplease

    Slideshow using XML to stop looping and fade out at the end

    respondplease
      Hi all,

      I've created a looping slideshow but I don't want the slideshow to loop - ie. to stop looping then stop at the last image and fade out to about 50% and then some text with a clickable link to pop up.

      I've used the code from the above mentioned tutorial ( http://www.kirupa.com/developer/mx20..._slideshow.htm) and deleted the preloader, next, and previous button AS. And I've modified the slideshow function to make the slideshow not loop by commenting out firstImage (as shown below) but I can't make it fade out. And I've implemented another function called fadeout but it fades out my entire stage. I would only like to fade out the last image and have some text pop up. Here's the AS:

      function slideshow() {
      myInterval = setInterval(pause_slideshow, delay);
      function pause_slideshow() {
      clearInterval(myInterval);
      if (p == (total-1)) {
      p = 0; //reset the counter p to 0
      //firstImage();
      fadeout();
      } else {
      nextImage();
      }
      }
      }

      function fadeout() {
      this._alpha -= 50;
      if (this._alpha<=0) {
      this._alpha = 100;
      }
      }

      Any help, direction is greatly appreciated! Thanks again!
        • 1. Re: Slideshow using XML to stop looping and fade out at the end
          bahamagician
          You need to insert some code into the nextImage() function. Essentially, when the user clicks on the next Image button you want to test whether or not it's the last image and if it is the last image then you do whatever it is you want to do.

          So instead of this:

          function nextImage() {
          if (p<(total-1)) {
          p++;
          if (loaded == filesize) {
          picture._alpha = 0;
          picture.loadMovie(image[p], 1);
          desc_txt.text = description[p];
          picture_num();
          }

          }

          }


          You have this:

          function nextImage() {
          //check to see if this is the last image
          if (p>=(total-1)){
          //put the code here for what you want to happen after last pic
          picture._visible=false;
          }
          if (p<(total-1)) {
          p++;
          if (loaded == filesize) {
          picture._alpha = 0;
          picture.loadMovie(image[p], 1);
          desc_txt.text = description[p];
          picture_num();
          }

          }

          }
          • 2. Re: Slideshow using XML to stop looping and fade out at the end
            respondplease Level 1
            hi bahamagician,

            thanks for your reply. i understand your logic, but the AS you provided doesn't work. actually i don't have a button to click to the next image, the slideshow goes through each image and i've stopped the loop by taking out the firstImage line in the slideshow function.

            Any other suggestions?

            Thanks