4 Replies Latest reply on Jun 3, 2006 10:43 PM by Newsgroup_User

    Streaming Audio Question

    RSegars
      I'm working on a Flash intro and at the end of it I have a "stop" action. I have an audio file that begins streaming in the first frame. I want it to continue after the animations in my movie are done playing, however the music stops when it gets to the frame with the "stop" action. How do I keep my music playing until the end of the song with out a really long timeline?

      Thanks
        • 1. Re: Streaming Audio Question
          Realtoast
          Rather than have the sound loaded from within your root timeline, you want to load the streaming sound externally. Place your [presumably] mp3 in the same file as your main swf.

          In your Flash intro, create a layer and call it "actions" (if you haven't already), lock it (so as to prevent the mistake of adding anything other than actions to it later on). Click on the first frame of your new actions layer, and open the action panel and paste:


          onClipEvent(enterFrame){
          myMusic = new Sound(whatever);
          myMusic.loadSound("stairway_to_heaven.mp3", true);
          _soundbuftime = 1;
          }

          Obviously, replace "stairway_to_heaven.mp3" with your own music file's name(!). The above presumes that you keep your sound file in the same folder as the .swf that is running the movie. You can change the _soundbuftime if you feel that a little pre-advancement of the tune is required to prevent skipping as it loads. If your sound file is in a different folder, then it would be:

          onClipEvent(enterFrame){
          myMusic = new Sound(whatever);
          myMusic.loadSound("sounds/music/stairway_to_heaven.mp3", true);
          _soundbuftime = 1;
          }

          Where "sounds/music/" is changed to the path to the folder where you keep your music file.

          Then consider stopAllSounds() as a function in the escape button, if the user wishes to quickly advance out of the intro.

          Provolone!

          r


          • 2. Re: Streaming Audio Question
            Level 7

            "Realtoast" <webforumsuser@macromedia.com> wrote in message news:e5s7qj$5e1$1@forums.macromedia.com...
            > Rather than have the sound loaded from within your root timeline, you want to
            > load the streaming sound externally. Place your [presumably] mp3 in the same
            > file as your main swf.
            >
            > In your Flash intro, create a layer and call it "actions" (if you haven't
            > already), lock it (so as to prevent the mistake of adding anything other than
            > actions to it later on). Click on the first frame of your new actions layer,
            > and open the action panel and paste:
            >
            >
            > onClipEvent(enterFrame){
            > myMusic = new Sound(whatever);
            > myMusic.loadSound("stairway_to_heaven.mp3", true);
            > _soundbuftime = 1;
            > }

            enterFrame means on EVERY frame, not on ENTER frame. It is a poor choice of names by MM. You wouldn't want to load a new sound 12
            times per second (or whatever your frame rate is)

            The rest of it looks ok except changing the buftime to 1 second instead of the default 5 seconds for what reason? Just makes the
            timeline play stutter-start more often.
            tralfaz


            • 3. Re: Streaming Audio Question
              Realtoast Level 1
              Oops. I originally picked that code out of an on(release){ and made that ..enterFrame suggestion on the fly. You are correct on the buf time, as well. I appreciate the education (as I was unaware of the proper use of enterFrame).

              Thanks.

              r
              • 4. Re: Streaming Audio Question
                Level 7
                "Realtoast" <webforumsuser@macromedia.com> wrote in message news:e5spc8$otj$1@forums.macromedia.com...
                > Oops. I originally picked that code out of an on(release){ and made that
                > ..enterFrame suggestion on the fly. You are correct on the buf time, as well. I
                > appreciate the education (as I was unaware of the proper use of enterFrame).
                >
                > Thanks.
                >
                > r

                notta problem. That onEnterFrame thing confuses a lot of people because of the poor naming by MM. It takes awhile to learn all
                these little Flash quirks.
                tralfaz