7 Replies Latest reply on May 10, 2006 1:26 AM by dingsword

    Click a button, play some audio

    KillerHurdz
      Hey, I have some questions about how to improve a simple code. The code that I am refering to is this:

      on (press)
      {
      mySound1.start();
      }


      In the button, and

      var mySound1:Sound = new Sound();
      mySound1.attachSound("sound1");


      Outside the button, but on the frame that it is on.

      I was wondering if anyone could give me some help with 2 small problems...

      1.) If you click on the button again after the audio started to play, it will begin again and then you will have 2 audios running at the same time. Click again, 3, 4... I was thinking something that would check to see if it's playing, then if it is, make the button do nothing. Like with an else or something, but I have no clue on what that code would be (im a beginner at actionscript).

      2.) I want there to be more than 1 button for more than 1 audio file. So Lets say I press button "A" and some music starts playing, then I click on button "B", it then stops the audio from button "A" and plays the audio from button "B".

      I know this might be a lot to ask for, but it would really be great if it was possible.

      Thx a lot,
      KillerHurdz.