Class fever.medias.sound.AppSoundFactory

Description

Fever sound factory manager.

Allow to switch between defined sound factories.

Declared sound factories in configuration file :

 
   <sounds>
     <factory id="interface" url="interface.swf" ref="click" manager="true" run="true" />
     <factory id="interface2" url="interface2.swf" ref="click" manager="true" />
   </sounds> 
 

The manager attribute must be set to true to enable factory to be managed. run attribute define if factory must be loaded at startup or not. Default use the first factory added to manager.

then use the manager ( statics method ) to load factory you want

   AppSoundFactory.load( "interface2" );
   AppSoundFactory.getSoundFactory().getSound( "click" ).start();
 

Of course, all managed factories must have the sounds references to play nice.
Sounds library runtime switching !

Method Index

new AppSoundFactory()
getInstance(), getSound(), getSoundFactory(), getSoundFactoryList(), hasSound(), load(), loop(), play(), register(), toString(), unregister()

Constructor Detail

AppSoundFactory

public function AppSoundFactory(factoryName:String)

Constructor.

Method Detail

getInstance

static public function getInstance():AppSoundFactory

Returns unique AppSoundFactory instance.

register

static public function register(name:String):Boolean

Adds AppSoundFactory factory named name in repository manager.

After, you can switch factory using load() method.

unregister

static public function unregister(name:String):Void

Unregisters factory from manager.

load

static public function load(name:String):Void

Sets AppSoundFactory named name as current sound factory.

play

static public function play(soundID:String):Void

Shortcut to start passed-in soundID in current factory.

loop

static public function loop(soundID:String):Void

Shortcut to start passed-in soundID in current factory.
Loop mode.

getSoundFactory

static public function getSoundFactory():AppSoundFactory

Returns current sound factory.

getSoundFactoryList

static public function getSoundFactoryList():Array

Returns registred sound factory id list.

getSound

public function getSound(id:String):Sound

Overrides SoundFactory.getSound() method to log an error message if passed-in id sound not exist in factory.

hasSound

public function hasSound(soundID:String):Boolean

Returns true if passed-in soundID is registred into current sound factory.

toString

public function toString():String

Returns string representation.