User Guide

Creating interactivity and visual effects 189
Creating sound controls
You use the built-in Sound class to control sounds in a SWF file. To use the methods of the
Sound class, you must first create a Sound object. Then you can use the
attachSound() method
to insert a sound from the library into a SWF file while the SWF file is running.
When the user releases the Play button, a song plays through the speaker.
The Sound classs
setVolume() method controls the volume, and the setPan() method adjusts
the left and right balance of a sound.
When the user drags the volume slider, the setVolume() method is called.