Flash Lite 2 |
|||
| Developing Flash Lite 2.x Applications > Working with Sound, Video, and Images > Using device sound (Flash Professional only) > 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:
start() method to play the sound once it is fully loaded (see the following code example).loadSound() method does not support that method's second parameter (isStreaming). Flash Lite ignores this parameter if it is present.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");