AS3: Stop all sounds from playing

If you ever need to stop all the sounds playing in flash using ActionScript3, you can do so using the following method.

First include the SoundMixer class:

import flash.media.SoundMixer;

Then to stop the sounds call the stopAll method:

SoundMixer.stopAll();

Flash AS3: Play sound from the library

In order to play a sound from the library you can use the following simple AS3 code:

var snd:Beep = new Beep();
snd.play();

You must also assign your sound clip a class name by right clicking the sound in the library and checking the export for ActionScript option. In the example above the class name was set to “Beep”.

The default base class  is set to “Sound”, allowing inheritance of methods from the Sound Class.