6 Replies Latest reply on Feb 21, 2014 7:54 AM by Machu Picchu Ltd

    play/pause animation in sync with toggle audio

    Machu Picchu Ltd

      hi guys,

       

      trying to figure out how to have an animation play and pause in sync with a toggle audio button, any ideas? its driving me crazy!

       

       

       

      cheers

        • 1. Re: play/pause animation in sync with toggle audio
          hemanthR Adobe Employee

          I have sample here where the play and pause  of audio and indicator on button and the symbol aniamte syncs with user action.

          https://www.dropbox.com/s/i07cx43ashtu6lu/soundToggle.zip

           

          Check if this is what you were looking for

          1 person found this helpful
          • 2. Re: play/pause animation in sync with toggle audio
            Machu Picchu Ltd Level 1

            great this has worked a treat, just had to change the paths around

             

            // Pause the audio track.

            sym.getComposition().getStage().getSymbol('loveScreen').getSymbol('toggleAudio').$("love2" )[0].pause();

            // Set the value of a Symbol variable

            sym.setVariable("isPlaying",false);

            sym.getComposition().getStage().getSymbol('loveScreen').getSymbol('toggleAudio').getSymbol ("timer").stop();

             

             

             

             

            }else{

            // Play the audio track.

            sym.getComposition().getStage().getSymbol('loveScreen').getSymbol('toggleAudio').$("love2" )[0].play();

            sym.setVariable("isPlaying",true);

            sym.getComposition().getStage().getSymbol('loveScreen').getSymbol('toggleAudio').getSymbol ("timer").play();

            }

             

             

             

            many thanks for your help you saved me a good few hours work!

            • 3. Re: play/pause animation in sync with toggle audio
              hemanthR Adobe Employee

              Glad it worked for you!

              • 4. Re: play/pause animation in sync with toggle audio
                Machu Picchu Ltd Level 1

                do you know if theres a way i can kill the audio thats playing when loading another audio, if thats makes sense.

                 

                so i've got 6 buttons that show diffrent symbols with audio and animations in, when you click button A if your watching button B  i'm getting the audio still playing from the symbol on button B if its not paused.

                • 5. Re: play/pause animation in sync with toggle audio
                  hemanthR Adobe Employee

                  You could query all the audio tags and pause them using Jquery code.

                  • 6. Re: play/pause animation in sync with toggle audio
                    Machu Picchu Ltd Level 1

                    hi,

                     

                    yeah i thought about that problem is i've got 2 animations playing to indictae the audio is playing, ones a timer and the other is just a logo for that page pulsing in time to the audio.

                     

                    when the user clicks to a new page/screen i'm pausing the audio and animations and chaging the play button txt back to play (from pause)

                     

                    then when you come back into the screen you just left its all looks fine but i have to click twice on the play button to start the audio off again

                     

                    i cant figure it i'm sure its something easy, heres my code,

                     

                    the navigation i..e clicking to another screen from a screen playing the audio

                     

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

                    if (current != "") {

                       sym.getSymbol(current).play("out");

                       sym.getSymbol("loveScreen").play("in");

                    }

                    else {

                       sym.getSymbol("loveScreen").play("shortIn");

                    }

                    sym.setVariable("current", "loveScreen");

                    sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPlay').$("creat ive")[0].pause();

                    sym.getComposition().getStage().getSymbol('createScreen').getSymbol("createTimer").stop();

                    sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPulse').stop();

                    sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPlay').stop('cr eateStart');

                    sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPlay').$('btntx t').html('play');

                     

                    then my code for the screen playing the audio intially

                     

                    if (sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPlay').PlayCr eate === 0) {

                        sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPlay').PlayCre ate = 1;

                        sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPlay').playRev erse();

                        sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPlay').$('btnt xt').html('play');

                     

                     

                    } else {

                            sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPlay').PlayCre ate = 0;

                            sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPlay').play();

                                   sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPlay').$('btnt xt').html('pause');

                     

                     

                    }

                     

                     

                     

                     

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

                     

                     

                     

                     

                    if(isPlaying){

                    // Pause the audio track.

                    sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPlay').$("creat ive")[0].pause();

                    // Set the value of a Symbol variable

                    sym.setVariable("isPlaying",false);

                    sym.getComposition().getStage().getSymbol('createScreen').getSymbol("createTimer").stop();

                    sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPulse').stop();

                     

                     

                     

                     

                    }else{

                    // Play the audio track.

                    sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPlay').$("creat ive")[0].play();

                    sym.setVariable("isPlaying",true);

                    sym.getComposition().getStage().getSymbol('createScreen').getSymbol("createTimer").play();

                    sym.getComposition().getStage().getSymbol('createScreen').getSymbol('createPulse').play();

                     

                     

                    }