addSound
Usage
private function addSound($linkageID:*, $preloadedSound:Sound, $path:String, $name:String, $buffer:Number = 1000, $checkPolicyFile:Boolean = false):Boolean
Description
Returns
Nothing
addLibrarySound
Usage
public function addLibrarySound($linkageID:*, $name:String):Boolean
Description
Adds a sound from the library to the sounds dictionary for playing in the future.
Parameters
- $linkageID
- The class name of the library symbol that was exported for AS
- $name
- The string identifier of the sound to be used when calling other methods on the sound
Returns
Boolean A boolean value representing if the sound was added successfully
addExternalSound
Usage
public function addExternalSound($path:String, $name:String, $buffer:Number = 1000, $checkPolicyFile:Boolean = false):Boolean
Description
Adds an external sound to the sounds dictionary for playing in the future.
Parameters
- $path
- A string representing the path where the sound is on the server
- $name
- The string identifier of the sound to be used when calling other methods on the sound
- $buffer
- The number, in milliseconds, to buffer the sound before you can play it (default: 1000)
- $checkPolicyFile
- A boolean that determines whether Flash Player should try to download a cross-domain policy file from the loaded sound's server before beginning to load the sound (default: false)
Returns
Boolean A boolean value representing if the sound was added successfully
addPreloadedSound
Usage
public function addPreloadedSound($sound:Sound, $name:String):Boolean
Description
Adds a sound that was preloaded by an external library to the sounds dictionary for playing in the future.
Parameters
- $sound
- The sound object that was preloaded
- $name
- The string identifier of the sound to be used when calling other methods on the sound
Returns
Boolean A boolean value representing if the sound was added successfully
removeSound
Usage
public function removeSound($name:String):void
Description
Removes a sound from the sound dictionary. After calling this, the sound will not be available until it is re-added.
Parameters
- $name
- The string identifier of the sound to remove
Returns
void
removeAllSounds
Usage
public function removeAllSounds():void
Description
Removes all sounds from the sound dictionary.
Returns
void
playSound
Usage
public function playSound($name:String, $volume:Number = 1, $startTime:Number = 0, $loops:int = 0, $resumeTween:Boolean = true):void
Description
Plays or resumes a sound from the sound dictionary with the specified name. If the sounds in the dictionary were muted by
the muteAllSounds() method, no sounds are played until unmuteAllSounds() is called.
Parameters
- $name
- The string identifier of the sound to play
- $volume
- A number from 0 to 1 representing the volume at which to play the sound (default: 1)
- $startTime
- A number (in milliseconds) representing the time to start playing the sound at (default: 0)
- $loops
- An integer representing the number of times to loop the sound (default: 0)
- $resumeTween
- A boolean that indicates if a faded sound's volume should resume from the last saved state (default: true)
Returns
void
pauseSound
Usage
public function pauseSound($name:String, $pauseTween:Boolean = true):void
Description
Pauses the specified sound.
Parameters
- $name
- The string identifier of the sound
- $pauseTween
- A boolean that either pauses the fadeTween or allows it to continue (default: true)
Returns
void
stopSound
Usage
public function stopSound($name:String):void
Description
Stops the specified sound.
Parameters
- $name
- The string identifier of the sound
Returns
void
playAllSounds
Usage
public function playAllSounds($resumeTweens:Boolean = true, $useCurrentlyPlayingOnly:Boolean = false):void
Description
Plays all the sounds that are in the sound dictionary.
Parameters
- $resumeTweens
- A boolean that resumes all unfinished fade tweens (default: true)
- $useCurrentlyPlayingOnly
- A boolean that only plays the sounds which were currently playing before a pauseAllSounds() or stopAllSounds() call (default: false)
Returns
void
pauseAllSounds
Usage
public function pauseAllSounds($pauseTweens:Boolean = true, $useCurrentlyPlayingOnly:Boolean = true):void
Description
Pauses all the sounds that are in the sound dictionary.
Parameters
- $pauseTweens
- A boolean that either pauses each SoundItem's fadeTween or allows them to continue (default: true)
- $useCurrentlyPlayingOnly
- A boolean that only pauses the sounds which are currently playing (default: true)
Returns
void
stopAllSounds
Usage
public function stopAllSounds($useCurrentlyPlayingOnly:Boolean = true):void
Description
Stops all the sounds that are in the sound dictionary.
Parameters
- $useCurrentlyPlayingOnly
- A boolean that only stops the sounds which are currently playing (default: true)
Returns
void
fadeSound
Usage
public function fadeSound($name:String, $targVolume:Number = 0, $fadeLength:Number = 1, $stopOnComplete:Boolean = false):void
Description
Fades the sound to the specified volume over the specified amount of time.
Parameters
- $name
- The string identifier of the sound
- $targVolume
- The target volume to fade to, between 0 and 1 (default: 0)
- $fadeLength
- The time to fade over, in seconds (default: 1)
- $stopOnComplete
- Added by Danny Miller from K2xL, stops the sound once the fade is done if set to true
Returns
void
muteAllSounds
Usage
public function muteAllSounds():void
Description
Mutes the volume for all sounds in the sound dictionary.
Returns
void
unmuteAllSounds
Usage
public function unmuteAllSounds():void
Description
Resets the volume to their original setting for all sounds in the sound dictionary.
Returns
void
setSoundVolume
Usage
public function setSoundVolume($name:String, $volume:Number):void
Description
Sets the volume of the specified sound.
Parameters
- $name
- The string identifier of the sound
- $volume
- The volume, between 0 and 1, to set the sound to
Returns
void
getSoundVolume
Usage
public function getSoundVolume($name:String):Number
Description
Gets the volume of the specified sound.
Parameters
- $name
- The string identifier of the sound
Returns
Number The current volume of the sound
getSoundPosition
Usage
public function getSoundPosition($name:String):Number
Description
Gets the position of the specified sound.
Parameters
- $name
- The string identifier of the sound
Returns
Number The current position of the sound, in milliseconds
getSoundDuration
Usage
public function getSoundDuration($name:String):Number
Description
Gets the duration of the specified sound.
Parameters
- $name
- The string identifier of the sound
Returns
Number The length of the sound, in milliseconds
getSoundItem
Usage
public function getSoundItem($name:String):SoundItem
Description
Gets the SoundItem instance of the specified sound.
Parameters
- $name
- The string identifier of the SoundItem
Returns
SoundItem The SoundItem
isSoundPaused
Usage
public function isSoundPaused($name:String):Boolean
Description
Identifies if the sound is paused or not.
Parameters
- $name
- The string identifier of the sound
Returns
Boolean The boolean value of paused or not paused
isSoundPausedByAll
Usage
public function isSoundPausedByAll($name:String):Boolean
Description
Identifies if the sound was paused or stopped by calling the stopAllSounds() or pauseAllSounds() methods.
Parameters
- $name
- The string identifier of the sound
Returns
Number The boolean value of pausedByAll or not pausedByAll
onSoundLoadError
Usage
private function onSoundLoadError($evt:IOErrorEvent):void
Description
Dispatched when an external sound can't load and produces an error.
Returns
Nothing
onSoundLoadProgress
Usage
private function onSoundLoadProgress($evt:ProgressEvent):void
Description
Dispatched when an external sound is loading.
Returns
Nothing
onSoundLoadComplete
Usage
private function onSoundLoadComplete($evt:Event):void
Description
Dispatched when an external sound is fully loaded.
Returns
Nothing
handleFadeComplete
Usage
private function handleFadeComplete($evt:SoundManagerEvent):void
Description
Dispatched once a sound's fadeTween is completed if the sound was called to fade.
Returns
Nothing
handleSoundPlayComplete
Usage
private function handleSoundPlayComplete($evt:SoundManagerEvent):void
Description
Dispatched when a SoundItem has finished playback.
Returns
Nothing