This content has been marked as final. Show 9 replies
in as2 you can use stopAllSounds().
also, if you haven't defined scopes or targets for the SoundObjects, setVolume(0) should act globally.
I haven't defined targets as they are kind of spread around. So can I add that line of code to a button event?
> I haven't defined targets as they are kind of spread
> around. So can I add that line of code to a button event?
You can. As dbeech mentioned, the Sound class acts globally in
ActionScript 2.0 if you omit a target in the constructor to the Sound class.
This basically means you can easily create a global volume control as
described here (doesn't matter if your sounds are timeline based or
Contributor, How to Cheat in Flash CS3
"Luck is the residue of good design."
attach stopAllSounds() wherever and whenever you want all sounds to stop.
yes, but this will not 'stop' the sounds, do that as kglad indicated above, however when the playhead moves again the sounds will play when initiated. to use the setVolume(0) method you will need to target any of the sounds you already have, or create a 'global' sound to use for this purpose. Like on frame1 main timeline, create a generic Sound Object, doesn't even need to have a sound attached,
var mute:Sound = new Sound();
then from the button, target that Object by:
use setVolume(100) to resume.
EDIT: what the heck?!?!?!?!? there wasn't any other post here when I viewed this, sorry guys.
Hey thanks for the timely replies all! Much appreciated. & David Stiller! I'm a big fan of your blog! (although admittedly I must have missed that pointedly direct solution of ' how to toggle sound globally ' article) -- Thanks. Seems very simple - giving it a whirl now.
And directly after KGlad & clbeech replied - apparently the whole shootin' match went down for a while for some scheduled work. Nice timing.
But thanks again all.
yes, you're welcome, I'm sure it won't take you long now :)