MixSoundFactory
| Kind of class: | class |
|---|---|
| Inherits from: | SoundFactory |
| Version: | 1.0 |
| Author: | Francis Bourre |
| Classpath: | com.bourre.medias.sound.MixSoundFactory |
| File last modified: | Wednesday, 31 October 2007, 07:35:29 |
MixSoundFactory extends SoundFactory class adding volume, pan and gain controls for sound.
Example
function onSoundComplete( e : IEvent ) : Void { trace("play again"); } var sf : MixSoundFactory = new MixSoundFactory(); sf.addEventListener( MixSoundFactory.onSoundCompleteEVENT, this); sf.addSound("sound_1"); sf.setGain("sound_1", 50); sf.setPan(-50); sf.playSoundLoop("sound_1");
Summary
Constructor
Instance properties
Instance properties inherited from SoundFactory
Instance methods
Instance methods inherited from SoundFactory
Constructor
MixSoundFactory
function MixSoundFactory (
)
Constructs a new
MixSoundFactory instance.Class properties
onSoundCompleteEVENT
(read,write)
Broadcast when a sound finishes playing.
Component metadata:
| Event | onSoundLoad |
|---|
Instance methods
addSound
function addSound (
linkageID:String) : String
Adds new sound to factory.
Overrides SoundFactory.removeSound method, adding
sID sound in gain list.
Example
var sf : MixSoundFactory = new MixSoundFactory(); sf.addSound("sound_1"); sf.addSound("sound_2");
Parameters:
linkageID:
Sound identifier in swf file
Returns:
String sound identifierOverrides:
getGain
function getGain (
sID:String) : Number
Returns defined
gain for passed-in sID sound id.Parameters:
sID:
Sound id.
Returns:
Number valuegetPan
function getPan (
) : Number
Returns pan value.
Returns:
Number valuegetVolume
function getVolume (
) : Number
Returns volume value.
Returns:
Number valueplaySoundLoop
function playSoundLoop (
sID:String) : Void
Plays passed-in
sID identifier sound in loop mode.Overrides SoundFactory.playSoundLoop method adding event support when sound
finishes playing.
MixSoundFactory broadcast onSoundCompleteEVENT
Example
function onSoundComplete( e : IEvent ) : Void { trace("play again"); } var sf : MixSoundFactory = new MixSoundFactory(); sf.addSound("sound_1"); sf.addEventListener( MixSoundFactory.onSoundCompleteEVENT, this); sf.playSoundLoop("sound_1");
Overrides:
removeSound
function removeSound (
sID:String) : Void
Removes
Sound instance stored under passed-in sID identifier from factory.Overrides SoundFactory.removeSound method, removing
sID sound from gain list.
Example
var sf : MixSoundFactory = new MixSoundFactory(); sf.addSound("sound_1"); sf.removeSound("sound_1");
Overrides:
setAllGain
function setAllGain (
nGain:Number) : Void
Defines
gain value for all stored sounds.nGain should be between 0 and 127.
Parameters:
nGain:
Number valuesetGain
function setGain (
sID:String,
nGain:Number) : Void
Defines
gain value for passed-in sID sound.nGain should be between 0 and 127.
Parameters:
sID :
Sound id stored in factory
nGain:
Number valuesetPan
function setPan (
n:Number) : Void
Defines pan value for all sounds list.
n should be between -100 and 100.
Parameters:
n:
Number valuesetVolume
function setVolume (
n:Number) : Void
Defines volume value for all sounds list.
n should be between 0 and 100.
Parameters:
n:
Number valuetoString
function toString (
) : String
Returns the string representation of this instance.
Returns:
the string representation of this instance
Overrides: