Flash CS3 Documentation |
|||
| Programming ActionScript 3.0 > Working with sound > Working with embedded sounds | |||
Using embedded sounds, instead of loading sound from an external file, is most useful for small sounds that are used as indicators within your application's user interface, such as sounds that play when buttons are clicked.
When you embed a sound file in your application, the size of the resulting SWF file increases by the size of the sound file. In other words, embedding large sound files in your application can increase the size of your SWF file to an undesirable size.
The exact method of embedding a sound file into your application's SWF file varies according to your development environment.
The Flash authoring tool lets you import sounds in a number of sound formats and store them as symbols in the Library. You can then assign them to frames in the timeline or to the frames of a button state, use them with Behaviors, or use them directly in ActionScript code. This section describes how to use embedded sounds in ActionScript code with the Flash authoring tool. For information about the other ways to use embedded sounds in Flash, see "Importing Sounds" in Using Flash.
var drum:DrumSound = new DrumSound(); var channel:SoundChannel = drum.play();
DrumSound is a subclass of the flash.media.Sound class so it inherits the Sound class's methods and properties, including the play() method as shown above.
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00000287.html