Working with embedded sounds

In AIR, you can use JavaScript to access sounds embedded in SWF files. You can load these SWF files into the application using any of the following means:

  • By loading the SWF file with a <script> tag in the HTML page

  • By loading a SWF file using the runtime.flash.display.Loader class

    The exact method of embedding a sound file into your application’s SWF file varies according to your SWF content development environment. For information on embedding media in SWF files, see the documentation for your SWF content development environment

    To use the embedded sound, you reference the class name for that sound in ActionScript. For example, the following code starts by creating an instance of the automatically generated DrumSound class:

    var drum = new DrumSound(); 
    var channel = drum.play();

    DrumSound is a subclass of the flash.media.Sound class, so it inherits the methods and properties of the Sound class. The play() method included, as the preceding example shows.

// Ethnio survey code removed