Typically, the use of sound in your projects will entail loading sounds from external sources. Keeping your sounds external to your primary SWF has many benefits. It can keep the file size of your SWF from becoming too large, and it's easy to change the audio file without having to recompile your SWF, just to cite two examples.
Most of the examples we'll cover in this chapter use external sound files, but it is possible to use internal sounds without having to rely on the timeline. To prepare for the remaining examples, we'll show you how to store a reference to both an internal and an external sound. These references can then be used to play the sound, create a sound channel, and otherwise manage and manipulate the sound in examples that will soon follow.
Creating an instance of a sound from your library is consistent with creating an instance of a display symbol, as described in Chapter 4 during our discussion of the display list. After importing a sound, open the Symbol Properties or Linkage dialog, and click the Export for ActionScript check box. This will create a linkage identifier, in the form of a class name, by which you can refer to the sound. If you need to review any part of this process, see Chapter 4.
By default, the class name will be assigned automatically based on the name of the imported sound. This is important because the name of the sound may have a three-character extension, such as .mp3, or similar ...