5 Replies Latest reply on Jun 3, 2007 10:13 AM by kglad

    Using setInterval

    tlarge
      I am loading images to a slideshow from an array, holding the image in place for 5 seconds and then going to the next. Or that is what I hope to do. The slideshow is of homes for sale and there are a number of seperate homes with interior shots. So the code in the "nextimage" function cycles through each tour (i) and each image in that tour (k). I am calling a function (slideshow) immediately after loading the image that uses setInterval to pause the slideshow and then move to the next image. But when I call the slideshow function it returns immediately to the calling function (nextslide) without delay. I have placed traces to confirm and have attached the results of the trace below. Can anyone tell me what I am doing wrong here?
      Thanks,



        • 1. Re: Using setInterval
          kglad Adobe Community Professional & MVP
          there are many problems with that code. but to start, it's not clear where loaded and filesize are defined. judging from your coding, they probably aren't defined which is another set of problems.

          in any case, when loaded is equal to filesize, one or both of those for-loops are going to result in repeated calls to slideshow() are repeated setInterval() function calls that should result in chaos.
          • 2. Using setInterval
            tlarge Level 1
            Fair enough I am relatively new to this, (although eliminating the loaded==filesize if statement produces identical results).

            This works perfectly when I put the photos in a single dimensional array and physically increment the single variable ( b++) to move through the photos (Images(b)). It is when I do a for loop on a multidimensional array (mainArr(i)(k)), that the program plows through and only presents the last image seemingly ignoring setInterval.

            So, starting with what I am trying to accomplish which is incrementing through a multidimensional array to present each associated photo for five seconds before moving on to the next, can anyone point me in the direction of a solution (again because I have limited experience with flash, code suggestions would be most helpful).

            Thanks for any help.
            • 3. Re: Using setInterval
              kglad Adobe Community Professional & MVP
              you should load all your images before starting your slide show. that would be the easiest solution and the only one that would allow you to safely display each image for 5 seconds before advancing to the next image.
              • 4. Using setInterval
                tlarge Level 1
                There are potentially 1000s of images, the array in the code is using a test and very limited XML file to poputate the array. The real thing will be much larger
                • 5. Re: Using setInterval
                  kglad Adobe Community Professional & MVP
                  then you'll need to use a preloader to load the particular "tour" that you want to display. when that's loaded you can start your slide show (using setInterval) for that particular tour.