3 Replies Latest reply on Jul 19, 2013 4:23 PM by AMULI

    Slideshow back button problem

    Gjence

      Hello

       

      I have created a slideshow using Edge Animate and it has a set of selected pictures (number of pictures wont increase for now) and they change automatically after 5 seconds. The slideshow also includes two buttons: Next and Back. The next button works fine, it has the following code:

      sym.play();
      

       

      Simple as that. I thought that sym.playReverse(); would solve my problem for the back button, but it didn't. It just goes back to the previous pic and stays there for not even a second and then goes forward again. I want to delay this back button to the normal delay time which is 5 seconds. So when someone clicks back, he gets to the previous picture and stays there for 5 seconds.

       

      Just for reference purposes, here is my code that automatically "slides" the pictures after 5 seconds automatically:

      sym.stop();
      setTimeout(function(){sym.play();},5500);
      

      Each picture (label-ed) has this code.

       

      So how do I make my back button work as it should?

       

      Thank you.

        • 1. Re: Slideshow back button problem
          Whelanart

          I'm having a similar problem I'm pretty sure this would be basic my slideshow fades from one image to the next every 2 seconds  when I click on the back button I would like it to go back to seconds from the current frame on the timeline could anybody tell me what the proper code would be to work

          • 2. Re: Slideshow back button problem
            AMULI Level 4

            Hi Whelanart,

            to go back to seconds from the current frame on the timeline

             

            sym.play( sym.getPosition() -2000);

             

            Gil

            • 3. Re: Slideshow back button problem
              AMULI Level 4

              Suppose an image slider with eight pictures, each on screen 4 s (1 s fade in ; 2 s 100% ; 1 s fade out). The start of each 4 s sequence is labelled. We store the labels in an array :

               

              var pictures = ["pict1","pict2","pict3","pict4","pict5","pict6","pict7","pict8"];

              var duration = 4000;

               

              Flash has a MovieClip.currentLabel property. In Edge, we must compute it : we divide the position by duration, and rounding down the result gives the index in the pictures array. We make this a function accessible in the stage symbol :

               

              sym.currentLabel = function( position)

              {

                var iCurrent = Math.floor( position /duration);

                return pictures[ iCurrent];

              }

               

              To program a previous button we need to compute the previous label in the array considered as a circular list. So if iCurrent is the first index (0), iPrevious will be the last (pictures.length -1) ; else just subtract 1 :

               

              sym.previousLabel = function( position)

              {

                var iCurrent = Math.floor( position /duration);

                var iPrevious = iCurrent == 0 ? pictures.length -1 : iCurrent -1;

                return pictures[ iPrevious];

              }

               

              Similarly :

               

              sym.nextLabel = function( position)

              {

                var iCurrent = Math.floor( position /duration);

                var iNext = iCurrent == pictures.length -1 ? 0 : iCurrent +1;

                return pictures[ iNext];

              }

               

              The nextArrow.click event handler is then :

               

              sym.play( sym.nextLabel( sym.getPosition()));

               

              And the prevArrow.click event handler :

               

              sym.play( sym.previousLabel( sym.getPosition()));

               

              Downloadable example here : https://app.box.com/s/tp46oi7e4k91gsynrndn

               

              Gil

              1 person found this helpful