This content has been marked as final.
Show 4 replies
-
-
2. Re: any command opposite of stopAllSounds()?
Newsgroup_User Aug 5, 2008 6:14 PM (in response to bhnh)bhnh,
> I'd like to code a button to alternately turn off and turn
> on the audio... button clicks, etc... in a swf.
You'll want the Sound class for that. Works great, and it's easy. :)
> stopAllSounds() does the trick for turning the audio off;
> is there an equivalent to turn the audio back on?
stopAllSounds() is good in a pinch, but like youv'e discovered it's
really nothing more than a one-way street. If you associate a Sound
instance with the main timeline, you can set its volume all the way on or
off, and that effectively gives you a global sound toggle.
http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally
http://www.quip.net/blog/2006/flash/actionscript-20/understanding-the-sound-constructor
David Stiller
Co-author, ActionScript 3.0: The Quick Answer Guide for Flash Professionals
http://tinyurl.com/2s28a5
"Luck is the residue of good design."
-
3. Re: any command opposite of stopAllSounds()?
bhnh Aug 6, 2008 6:03 AM (in response to Newsgroup_User)Thanks, David. I had pretty much reached that conclusion shortly after posting; wishful thinking, I guess. I actually haven't had to do much with audio since working in Flash 5. I wound up just pushing all the various Sound objects into an array, then applying setVolume() to the array. Works just fine. -
4. Re: any command opposite of stopAllSounds()?
Newsgroup_User Aug 6, 2008 6:40 AM (in response to Newsgroup_User)bhnh,
> I wound up just pushing all the various Sound objects
> into an array, then applying setVolume() to the
> array. Works just fine.
That could potentially give you individualized control over each Sound
object, which would certainly do it. Toggling sound globally means you can
do it all in one swoop. That's what I love about ActionScript ... the
flexbility! :)
Glad you found a solution.
David Stiller
Contributor, How to Cheat in Flash CS3
http://tinyurl.com/2cp6na
"Luck is the residue of good design."