7 Replies Latest reply on Apr 24, 2007 7:45 PM by kglad

    onSoundComplete MP3 "reset" question

    Nathan_Aaron
      Hello. Any help is greatly appreciated. I've worked hard to get this working by roaming the net forever, and it's working out great, except for one small final touch.

      I have two MP3s that I am playing as background music on my site. They stream automatically when the site starts, and it's working. The first one plays, when it's done, the second starts. Then it stops. I had a bit of a problem with the second one starting again (looping), so I added the last bit of code //my_sound.onSoundComplete = function () {my_sound.stop()// to stop that, and that is working fine.

      My problem is two fold. First, the stop button no longer works at all. It does nothing (and it worked fine before I added that bit of "my_sound.stop" code. If I remove that code, the stop button will work again, but the second MP3 goes back into loop mode.) What I'm wanting to accomplish is, in as simple code as possible, have the two MP3s play one after another, then stop. Of course the stop button would do it's thing, and with the start button, I need it to, once both MP3s have finished, "reset" itself so if you click on it after all MP3s have played, it will start over with the first MP3. Right now, if the first MP3 is playing and you hit start, it repeats the first MP3, and if you hit the start during the second MP3 playing, it starts the second MP3 again (which I like how that works.) but when they both finish, and there is no music, if you hit start, it replays only the second MP3, not the first. Make sense? I hope so, I can be confusing. Here is the code. Thanks alot! :-)

      //sound code//
      var my_sound:Sound = new Sound();
      my_sound.loadSound("morningstar.mp3",true);
      my_sound.onSoundComplete = function () {
      my_sound.stop();
      my_sound.loadSound("limpid.mp3",true);
      my_sound.start();
      my_sound.onSoundComplete = function () {my_sound.stop()
      };
      };

      //code on start button//
      on (release) {
      my_sound.start();
      }

      //code on stop button//
      on (release) {
      my_sound.stop();
      }