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 :)
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.
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.
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 :)
Don't see what you're looking for? Try a search.
|