3 Replies Latest reply on May 26, 2008 9:46 AM by clbeech

    Loading multiple audio files into a single frame

      What I'm trying to do is just have a song loop continuously in a stopped frame (which is easy enough), but the song I want to use has 12 seconds of intro before the loop begins. The only way I can think of to do this is to split the intro and loop into two different files, then have it load the intro, play it once, then once the intro finishes load the loop file and play it. Unless there's some way I can have the file loop but specify that it should start over at 00:12 each time instead of 00:00. Is there any way I can do this without just having 12 seconds of frames playing the intro and then a stopped frame with the loop?

      By the way, I'm using AS2 for this project.
        • 1. Re: Loading multiple audio files into a single frame
          kglad Adobe Community Professional & MVP
          use the flash sound class, not the timeline to create sounds. use two instances load them both before starting your intro. using its onSoundComplete method start your 2nd sound and assign its loop parameter so it loops indefinitely.
          • 2. Loading multiple audio files into a single frame
            wesm9787 Level 1
            Thanks for the help. I wasn't even aware that the onSoundComplete method existed, though, so I have no idea what the syntax would be. How would I go about writing the code? I already have the audio file attached to a sound object so that I could fade it at the end. Basically the audio file loops until the user presses a key, at which point the timeline progresses to the next frame and the loop fades out. The file is exported for ActionScript with the identifier "Prelude." The code I'm using for the audio file is attached below.
            • 3. Re: Loading multiple audio files into a single frame
              clbeech Level 3
              well to use the onSoundComplete handler the syntax would be:

              preludeLoop.onSoundComplete = function() {
              //do your stuff here

              however in order to 'fade' the sound out, you will need to create a method that loops down through the setVolume property of the Sound instance until it reaches 0, as in something like:

              function fadeOut() {
              var vol=100;
              onEnterFrame = function() {
              (vol>0) ? vol-=5 : delete onEnterFrame;