Playing external device sounds

In addition to playing device sounds that are bundled in the published SWF file (see Using bundled device sound), you can also load and play external sound files. To play external device sounds you use the loadSound() method of the Sound object. As with bundled device sound, the Flash Lite player passes the externally loaded audio to the device to decode and play.

The following information about playing external device sounds in Flash Lite 2.0 is important to remember:

The following code shows how to load and play an external sound file:

// Create the sound object.
var mySound:Sound = new Sound();
// Define onLoad handler for sound,
// which starts the sound once it has fully loaded.
mySound.onLoad = function(success){
    if(success == true) {
        mySound.start();
    }
}
// Load the sound.
mySound.loadSound("http://www.macromedia.com/audio.midi");