Be a Supporter!

Stop Sounds from spamming.

  • 260 Views
  • 2 Replies
New Topic Respond to this Topic
megadoctor
megadoctor
  • Member since: Apr. 9, 2005
  • Offline.
Forum Stats
Member
Level 14
Melancholy
Stop Sounds from spamming. 2011-12-10 07:51:25 Reply

What I'm trying to do is to create something like a soundboard.

But the problem is when I click one button many times the sound doesnt stop and start it just starts again making the sounds spam together and sound horrible.

Is there any way to stop and start a sound on the same button so that the sounds wont be spammed together?

megadoctor
megadoctor
  • Member since: Apr. 9, 2005
  • Offline.
Forum Stats
Member
Level 14
Melancholy
Response to Stop Sounds from spamming. 2011-12-10 12:07:41 Reply

Like if you had a button which plays a sound, and when you click it 1000 times, the sound starts 1000 times.

What I'm trying to do is 1 - click, 1 - sound and each time you click the button all other sounds stop, and only one sound starts. One at a time.

kylelyk
kylelyk
  • Member since: May. 15, 2008
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Stop Sounds from spamming. 2011-12-14 16:58:22 Reply

When one of the buttons is pushed, make a var that references that sound. Then you need to put some code into the buttons that checks to see if that variable has a reference, and, if it does, stop the sound using the reference and start the next sound.This cycle will be repeated. This method works well in AS3, but I don't know about AS2.


Kylelyk: Forwards and Backwards, Over and Out.

BBS Signature