Recipe 17.11. Stopping All Sounds


Problem

You want to stop all sounds.

Solution

Use the stopAllSounds( ) function.

Discussion

Recipe 17.10 shows you how to stop individual sounds. You can also stop all sounds using the stopAllSounds( ) function. When this function is invoked, all sounds that are playing are immediately stopped. It doesn't matter if the sounds were started with a button or from the playhead entering a timeline keyframe.

 stopAllSounds(); 

If you want to use a button to stop all sounds, you can place the function call within an event handler method.

 btn.onRelease = function() {   stopAllSounds(); } 

Or, if you want to stop all the sounds when the playhead enters a certain frame, you can add the function to that keyframe.




Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net