5 Replies Latest reply on Dec 28, 2013 9:07 PM by edwinmerced

    Previous and Next Buttons

    edwinmerced Level 1

      I have manage thus far for programming a next and previous button but it seems quirky. Sometimes it behaves erratically. Can someone lend a hand to identify the issue? The issue is specilly troublesome in when I use the first slide button and last slide button which have the follwong code

       

      FIRST SLIDE BUTTON: sym.stop("TITLE");

       

       

      LAST LIDE BUTTON: sym.stop("SUMMARY");

       

       

       

      $("#Stage").css("margin","auto")

       

       

      /////////////////////////

      var myArray = [

      {'myLabel':'TITTLE'},

      {'myLabel':'OBJECTIVES'},

      {'myLabel':'SLIDE1'},

      {'myLabel':'SLIDE2'},

      {'myLabel':'SLIDE3'},

      {'myLabel':'SLIDE4'},

      {'myLabel':'SLIDE5'},

      {'myLabel':'SLIDE6'},

      {'myLabel':'SLIDE7'},

      {'myLabel':'SLIDE8'},

      {'myLabel':'SLIDE9'},

      {'myLabel':'SUMMARY'}

      ]

       

       

      ////////////////////////////////////////////////////

       

      i=0;

       

      ///////////////////////////////////////////////////

       

       

      sym.$('NEXTSLIDE_BTN').click(function(){

       

       

                          i++;

       

       

           if (i<myArray.length){    

       

                          sym.play(myArray[i].myLabel);

       

           } else {

       

                          i=myArray.length-1;

       

           }

       

       

      });

       

      ///////////////////////////////////////////////////

       

       

      sym.$('PREVIOUSSLIDE_BTN').click(function(){

       

                sym.playReverse();

                i=0;

      });

       

       

      Thanks for any help.

        • 1. Re: Previous and Next Buttons
          resdesign Adobe Community Professional & MVP

          try something like this:

          // set i to be -1 so that the first click will give 0 or the first slide - I am hiding the buttons on the end for left or right.

          i=-1;

           

          sym.$('NEXTSLIDE_BTN').click(function(){

                i++;

                sym.play(myArray[i].myLabel);  // plays the timeline labels

                                   if (i>myArray.length){

                                        sym.$('NEXTSLIDE_BTN').hide();

                      // stop on end of array

                     i=myArray.length;

                                   }

          });

           

          sym.$('PREVIOUSSLIDE_BTN').click(function(){

               i--;

               sym.playReverse(myArray[i].myLabel);  // you might have to add stops for the reverse.

                if (i<0){

                    sym.$('PREVIOUSSLIDE_BTN').hide();

                    // reset i

                   i=-1;

               }

          });

           

          Let me know if this helps. I may have some sample somewhere.

          1 person found this helpful
          • 2. Re: Previous and Next Buttons
            edwinmerced Level 1

            Thank you for the time.

             

             

            You solution worked somewhat but now some of my navigation buttons dissappear when I am mid way the and decide to return to first slide .

             

            Baffelled

            • 3. Re: Previous and Next Buttons
              resdesign Adobe Community Professional & MVP

              Sorry I was out for a while.

              Interesting. Do you have your labels in order in your array? The buttons should disappear only at i<0 and i>myArray.length. You may need to make your  next button visible again when you go back with the previous button. Try to understand what your buttons are doing and when and add the appropriate code for the buttons' visibility,

              Also you may need to add some stops on the timeline for when you go backwards with previous.

              • 4. Re: Previous and Next Buttons
                edwinmerced Level 1

                Hello:

                 

                Thank you for the follow-up.

                 

                You may look at the project here: jejedesigns.com/LESSON1/LESSON1.html to get an idea.

                 

                I was sure to put a stop action on every 1/2 second and label appropriatly each stop.

                 

                The issue is also that I also need to hide the first slide button and previous slide button on the first slide (stop) and hide the last slide and next slide button on the last slide stop (and make them re-appear (show) when not on the first or last slide.

                 

                 

                Than you

                • 5. Re: Previous and Next Buttons
                  edwinmerced Level 1

                  The code now looks like this (had some typos in my stops and code. But still no success

                   

                  var myArray = [

                  {'myLabel':'TITLE'},

                  {'myLabel':'OBJECTIVES'},

                  {'myLabel':'SLIDE1'},

                  {'myLabel':'SLIDE2'},

                  {'myLabel':'SLIDE3'},

                  {'myLabel':'SLIDE4'},

                  {'myLabel':'SLIDE5'},

                  {'myLabel':'SLIDE6'},

                  {'myLabel':'SLIDE7'},

                  {'myLabel':'SLIDE8'},

                  {'myLabel':'SLIDE9'},

                  {'myLabel':'SUMMARY'}

                  ]

                   

                   

                   

                   

                  i=-1;

                   

                   

                  sym.$('NEXTBTN_SYMINSTANCE').click(function(){

                        i++;

                        sym.play(myArray[i].myLabel);  // plays the timeline labels

                                           if (i>myArray.length){

                                                sym.$('NEXTBTN_SYMINSTANCE').hide();

                                                sym.$('LASTBTN_SYMINSTANCE').hide();

                              // stop on end of array

                             i=myArray.length;

                                           }

                  });

                   

                   

                  sym.$('PREVIOUSBTN_SYMINSTANCE').click(function(){

                       i--;

                       sym.playReverse(myArray[i].myLabel);  // you might have to add stops for the reverse.

                        if (i<0){

                            sym.$('FIRSTBTN_SYMINSTANCE').hide();

                            sym.$('PREVIOUSBTN_SYMINSTANCE').hide();

                            // reset i

                           i=-1;

                       }

                  });

                  1 person found this helpful