Groups | Blog | Home
all groups > flash (macromedia) > may 2004 >

flash (macromedia) : stop other sounds?



whiteybags
5/16/2004 10:55:54 PM
I have eight buttons. Each button plays a different sound.

If the sound is playing from button1 & I press button2 the sound from button2
plays over the first sound.

How do I get it so that when I press button2 the sounds from all the other
buttons stops & ONLY the sound from button2 plays?

Please help :)
Shan-Dysigns
5/16/2004 11:19:00 PM
How are you triggering the sound to be played? You should be able to put the
code stopAllSounds() above the line that will trigger the new sound to play.
But like I said, it depends on how you are triggering the sounds to be played
once the button is clicked.
whiteybags
5/17/2004 9:51:38 AM
I've tried a couple of different ways and none of them seem to be working. The
sound just won't start now.

I tried declaring the sounds at the start on a seperate layer:
sound1 = newSound();
sound1.attachSound ("middlebit");

Then I added this code on the button
on (press) {
stopAllSounds();
}
on (release) {
_root.sound1.start()
}

I also tried the same except this code on the button
on (press) {
stopAllSounds();
_root.sound1.start()
}

I also tried putting all the code on the button
sound1 = newSound();
sound1.attachSound ("middlebit");
on (press) {
stopAllSounds();
}
on (release) {
_root.sound1.start()
}

I also tried clicking on to the button and added the sound on the Down State
but there was nowhere to put the code
stopAllSounds();
so I put that on the button (before clicking onto it).

Nothing seems to be working for me.
Shan-Dysigns
5/17/2004 7:15:02 PM
Just declare the new sound on release:

on (release) {
stopAllSounds();
sound1 = newSound();
sound1.attachSound ("middlebit");
sound1.start();
}

I think you tried them all except this one :)
AddThis Social Bookmark Button