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.
Get Flash 8 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.