BBM.net is designed to save you time and deliver the highest quality royalty-free music for your multimedia projects. Features include: over 450 Music Loop Packages from some of the best composers in the business, our music search engine to speed your selection process, alternate music versions & bonus sounds to use for rollovers or transitions, free technical support and free consulting.
When utilizing sound objects, the sound is never dragged
from the library onto stage or placed in a frame. The sound is defined in a
frame or movie clip and an identifying name is attached to the sound while it
resides in the library (except in the case of loading an external MP3).
For this section of the tutorial, "firstSound" will refer to the
name chosen for the instance of the sound object. Similarly,
"firstSound01" will refer to the identifying name inserted in the linkage
properties of the sound file that will be imported into the Flash library.
______________________________
Fig. 01: Sound object defined
Import one or more sound files into the Flash library by
selecting "File" and then "Import to Library."
Right-click (Windows) or control-click (Mac) on the sound file within the
library and select "Linkage..."
Select "Export for Actionscript" as shown in Fig02.
Fig.02: Linkage properties for a sound file
in the library.
Type in an identifier for the linkage ID.
The identifier, which, in this example, is firstSound01, must be unique. It
should not be the same as your sound object instance name or any other
identifier in your movie.
Decide where to define the sound objects.
If the sound objects are defined all on the same level, it simplifies
affecting the sound object later. For example, if the sound is defined
at the _root level and then is to be started by pressing a button within a
movie clip, the code would appear as follows:
on (press) { _root.firstSound.start()
}
If each sound object is defined in different movie clips, the path to the
sound object will need to be tracked. When a call is made to the sound object,
the complete path to the location where the sound object is defined will
need to be spelled out in the ActionScript. For example, if the sound object
is defined in a movie clip named "mc02" which is in another movie clip called
"mc01", the ActionScript would appear as follows:
on (press) { _root.mc01.mc02.firstSound.start();
}
When a sound object is attached using the attachSound method (as
is being described here), the sound will load, by default, as a child of
whichever movie clip in which the sound object was defined. However, a sound
object can be assigned as a child of any movie clip, regardless of where it is
defined. This is important because any call to a method of a sound object,
such as setVolume, will affect all sound objects which are the child of the
same movie clip. This will become more clear when you need to manipulate the
methods of multiple sound objects. Manipulating multiple sound objects is
articulated in the section: How to Control Independent Sound Objects
Simultaneously.
The ActionScript for defining your sound object will appear as in Fig.01.
In this example, the chosen sound object instance name is "firstSound". In
the second line, the instance name of "firstSound" is attached to a sound file
in the library by specifying that sound's linkage identifier, "firstSound01,"
which was created in the above step 4 and illustrated in Fig.02.
Your sound object is now defined and ready to be called into action.