Sound Class | Flash 6 |
control over sounds in a movie and external sound loading toolsFlash 5; enhanced in |
new Sound() new Sound(target)
A string indicating the path to the movie clip or document level whose sound is to be controlled. It can also be a reference to a movie clip or document level (references are converted to paths when used in a string context).
The total length of the sound, in milliseconds.
Access to the ID3 tags of an MP3 file.
The length of time the sound has played, in milliseconds.
Associate a sound from the Library with a Sound instance.
The number of downloaded bytes of an external sound file.
The physical disk size of an external sound file, in bytes.
Retrieve the current pan setting.
Determine the current distribution of the channels of a sound to the left and right speakers (i.e., balance).
Retrieve the current volume.
Download an external sound file into the Player.
Set the pan across a sound's left and right channels.
Distribute the left and right channels between the left and right speakers (i.e., balance).
Set the sound volume.
Start playing an attached or loaded event sound.
Silence all sounds or silence a specified attached or loaded sound.
Occurs when an external sound finishes loading.
Occurs when a sound finishes playing.
Objects of the Sound class are used to load external sounds and control both existing and loaded sounds in a movie. Sound objects can control:
All the sounds in the Flash Player
All the sounds in a particular movie clip instance or main movie (including all sounds in any nested clips)
An individual programmatically attached or downloaded sound
To create a Sound object that controls all the sounds in the Player (including sounds in .swf files on document levels), use the Sound constructor without any parameters. For example:
myGlobalSound = new Sound();
To create a Sound object that controls all the sounds in a particular clip or main movie, supply a target parameter indicating the clip or movie to control. Note that this also controls sounds in clips nested within target. For example:
spaceshipSound = new Sound("spaceship"); // Control sounds in spaceship clip mainSound = new Sound("_root"); // Control sounds on main timeline
To make an individual sound that can be started, stopped, and looped independently, create any kind of Sound object, and then add a sound to it using the attachSound( ) or loadSound( ) method.
To load an external sound file into a Sound object, use loadSound( ). A loading sound's progress can be monitored with getBytesLoaded( ), getBytesTotal( ), and onLoad( ).
Flash does not provide access to, or control over, sound frequency or pitch information, but Flash does expose the length of a sound (duration) and the elapsed time (position).
Flash can play a maximum of eight individual sounds simultaneously. When loaded via attachSound( ), each simultaneous sound needs its own Sound instance.
|
capabilities.hasAudio, stopAllSounds( ); _soundbuftime