3 Replies Latest reply on Mar 11, 2014 11:25 AM by jbowden

    Help with controlling audio

    philipeagles

      I have a horizontal slider which has left and right buttons to control the movement. I want to have audio narration on each of the clicks so for example. The user is on slide 1, clicks the right button to slide 2 and the audio narration for slide 2 starts, then user clicks the left button to go back to slide 1 and the audio narration for that slide starts etc etc. I currently have a total of 5 slides.

       

      So far this is the code I have:

       

      document.compositionReady:

       

      sym.setVariable("audioplay", "0"); // sets the initial value

       

      Right_btn.click:

       

      sym.getComposition().getStage().getSymbol("SceneHolderSymbol").play();

       

      var audioplay= sym.getVariable("audioplay");

       

          if (audioplay) {

       

              sym.setVariable("audioplay", "1");

       

              // insert your code that you want to do when it's clicked

                  sym.$("AF_Slide_21")[0].pause();

                  sym.$("AF_Slide_22")[0].play();

          }

       

      else if (audioplay) {

       

              sym.setVariable("audioplay", "2");

       

              // insert your code that you want to do when it's clicked

                  sym.$("AF_Slide_22")[0].pause();

                  sym.$("AF_Slide_23")[0].play();

          }

       

      else if (audioplay) {

       

              sym.setVariable("audioplay", "3");

       

              // insert your code that you want to do when it's clicked

                  sym.$("AF_Slide_23")[0].pause();

                  sym.$("AF_Slide_24")[0].play();

          }

       

          else if (audioplay) {

       

              sym.setVariable("audioplay", "4");

       

              // insert your code that you want to do when it's clicked

                  sym.$("AF_Slide_24")[0].pause();

                  sym.$("AF_Slide_25")[0].play();

          }

       

      PlayBtn.click: - This is the inital play button which plays the audio for the first page.

       

      sym.$("PlayBtn").hide();

      sym.$("AF_Slide_21")[0].play();

       

       

       

      I don't know if my approach is completely wrong but any help would be much appreciated.

       

      Thanks,

       

      Phil