Game Development Reference
In-Depth Information
if (_soundList[name]) {
return _soundList[name].isPaused;
}
else {
throw new Error( " Sound " + name + " does not exist. " );
}
return false;
}
public function isMuted(name:String = null):Boolean {
if (name) {
if (_soundList[name]) {
return _soundList[name].isMuted;
} else throw new Error( " Sound " + name + " does not
exist. " );
return false;
} else {
return _allMuted;
}
return true;
}
The pause and mute methods work the same way as their
SoundEngineObject counterparts, simply applying the setting to all
sounds or just one. If any sounds attempt to play when _allMuted
is true, they are created and then immediately muted as well. The
isMuted method reflects this as well
if no sound is specified, then
it will return the value of _allMuted. Also worth noting is that for
all of these methods (except isPlaying), an error is thrown if the
sound named doesn
'
t exist. That concludes the functionality of the
SoundEngine class.
You most likely noticed that the type of event dispatched by the
SoundEngine was of the type SoundEngineEvent, referring to the file
mentioned earlier. We
'
ll now take a quick look at that custom event.
package {
import flash.events.Event;
public class SoundEngineEvent extends Event {
static public const SOUND_COMPLETE:String =
"
;
static public const SOUND_STOPPED:String =
soundComplete
"
"
soundStopped
"
;
static public const SOUND_ERROR:String =
"
soundError
"
;
protected var _name:String;
public function SoundEngineEvent( type:String, name:
String, bubbles:Boolean=false, cancelable:Boolean=
false ){
Search Nedrilad ::




Custom Search