6 Replies Latest reply on Feb 7, 2014 5:38 PM by artfake
      • 1. Re: loop sound run by script
        elainecc Adobe Employee

        Hi, M-

         

        Sure.  You can use the snippets to find the code for "play audio from" in the actions pop-up from a trigger or any event handler.  Then, just replace the my_audio_element text with your element name.

         

        audioPlayback.png

         

        Hope that helps,

         

        -Elaine

        • 2. Re: loop sound run by script
          artfake Level 1

          Dear Elaine,

           

          thank you for your replay. But this answer not help me.

          I need to run plaing sound not once, but on repeat.

           

          "Play Audio From" run only once playing((

           

          M

          • 3. Re: loop sound run by script
            resdesign Adobe Community Professional & MVP

            You need to select your sound in the elements panel and check LOOP on the left panel.

            soundFX.pngloop sound.png

            or in script:

            loop = true;

            • 4. Re: loop sound run by script
              jbowden Adobe Employee

              To loop using code, you'd write something like this:

               

              sym.$("my_audio_element")[0].loop = true;

               

              Or as resdesign mentions, you can click the Loop checkbox in the audio element properties.

               

              The loop property is a Boolean (either you loop endlessly or not at all), so you can't loop x number of times using the same code. To do a finite number of loops, you'd write a loop manually, using play and currentTime and tracking the number of loops until it's done.

               

              hth,

              Joe

              • 5. Re: loop sound run by script
                resdesign Adobe Community Professional & MVP

                That is, exactly as Joe wrote the whole line for your sound.

                 

                Note:

                If you choose autoplay off,  and check loop you can start your sound with an event and here also you can use the snippet of code you can use.

                 

                For example a click event:

                 

                var btnFX = sym.$("btnFX")[0];

                var music = sym.$("music")[0];

                // set up the music toggle for both sounds

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

                          if (music.paused) {

                                    music.play();

                                    btnFX.play();

                                    sym.getSymbol('musicBtn').stop('on');

                          } else {

                                    music.pause();

                                    btnFX.pause();

                                    sym.getSymbol('musicBtn').stop('off');

                          }

                });

                • 6. Re: loop sound run by script
                  artfake Level 1

                  thank you, Joe.

                   

                  it's works!