Flash CS3 Documentation |
|||
| Developing Flash Lite 2.x Applications > Working with Sound, Video, and Images > Using device sound > Using bundled device sound | |||
To bundle a device sound in your application, you first import a proxy sound in a format that the Flash authoring tool recognizes, such as an MP3, WAV, or AIFF file. Then you link the proxy sound to a device sound file on your computer that you want to bundle in your application. During the SWF file publishing process, the Flash authoring tool replaces the proxy sound with the linked external sound. During playback, Flash Lite passes the sound data to the device to decode and play.
You can also package multiple device sounds in different formats in a single Flash sound bundle (FLS) file. This is useful if you're creating the same content for several devices that support different device sound formats. For more information, see Creating a sound bundle.
This following procedure demonstrates how to import and play a bundled device sound. To play a device sound you can either attach it to the Timeline or use the Sound object to play the device sound with ActionScript. This section explains both techniques.
For more information about using the Flash Lite document templates, see Creating a Flash Lite document template in Getting Started with Flash Lite 2.x.
|
NOTE |
|
You can use any sound file that's recognized by the Flash authoring tool as the proxy sound. The proxy.wav file is provided for your convenience. |
To play the device sound, you can either attach the proxy sound to the Timeline or use the ActionScript sound object. To use the ActionScript sound object, skip to step 6.
This attaches the proxy sound to the keyframe.
The Flash authoring tool displays the proxy sound's waveform in the Timeline. Waveforms for sounds that are linked to external device sounds are colored green; waveforms for sounds that are not linked to external device sounds are colored blue, as the following image shows.
var deviceSound:Sound = new Sound();
deviceSound.attachSound("device_sound");
deviceSound.start();
Flash CS3