Flash Player 5.
The Sound class lets you control sound in a movie. You can add sounds to a movie clip from the library while the movie is playing and control those sounds. If you do not specify a target when you create a new Sound object, you can use the methods to control sound for the whole movie.
You must use the constructor new Sound to create a Sound object before calling the methods of the Sound class.
| Method | Description |
|---|---|
Sound.attachSound() |
Attaches the sound specified in the parameter. |
Sound.getBytesLoaded() |
Returns the number of bytes loaded for the specified sound. |
Sound.getBytesTotal() |
Returns the size of the sound in bytes. |
Sound.getPan() |
Returns the value of the previous |
Sound.getTransform() |
Returns the value of the previous |
Sound.getVolume() |
Returns the value of the previous |
Sound.loadSound() |
Loads an MP3 file into Flash Player. |
Sound.setPan() |
Sets the left/right balance of the sound. |
Sound.setTransform() |
Sets the amount of each channel, left and right, to be played in each speaker. |
Sound.setVolume() |
Sets the volume level for a sound. |
Sound.start() |
Starts playing a sound from the beginning or, optionally, from an offset point set in the parameter. |
Sound.stop() |
Stops the specified sound or all sounds currently playing. |
| Property | Description |
|---|---|
Sound.duration |
Read-only; the length of a sound, in milliseconds. |
Sound.id3 |
Read-only; provides access to the metadata that is part of an MP3 file. |
Sound.position |
Read-only; the number of milliseconds a sound has been playing. |
| Event handler | Description |
|---|---|
Sound.onID3 |
Invoked each time new ID3 data is available. |
Sound.onLoad |
Invoked when a sound loads. |
Sound.onSoundComplete |
Invoked when a sound stops playing. |
Flash Player 5.
new Sound([target:Object]): Sound
target The movie clip instance on which the Sound object operates. This parameter is optional.
A reference to a Sound object.
Constructor; creates a new Sound object for a specified movie clip. If you do not specify a target instance, the Sound object controls all of the sounds in the movie.
The following example creates a new Sound object called global_sound. The second line calls setVolume() and adjusts the volume on all sounds in the movie to 50%.
var global_sound:Sound = new Sound(); global_sound.setVolume(50);
The following example creates a new Sound object, passes it the target movie clip my_mc, and calls the start method, which starts any sound in my_mc.
var movie_sound:Sound = new Sound(my_mc); movie_sound.start();
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001671.html
Comments
Chris Porro said on May 12, 2005 at 12:32 PM : de:jay said on May 15, 2005 at 4:25 PM : No screen name said on Jun 20, 2005 at 8:45 PM :