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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: