Copy link to clipboard
Copied
Im Making a Soundboard and a feature I wanted to add was a stop all sounds button for ActionScript 3 and I'm having trouble getting the button to work properly. The button is simply stop a sound being played after sound was clicked on. Any help on the script to create this is greatly appreciated (Yep, I'm a noob to actionscripts)
Copy link to clipboard
Copied
are you looking for code to 'prevent' future sounds from playing?
if so, you'll need to code that yourself. a basic boolean would work:
var allowSounds:Boolean = true;
your_mute_toggle_btn.addEventListener(MouseEvent.CLICK,muteF);
function muteF(e:MouseEvent):void{
allowSounds=!allowSounds;
}
//then every place you have code to play a sound, eg
sc=whatever.play();
//use
if(allowSound){
sc=whatever.play();
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now