| Package | com.whirled.contrib |
| Class | public class Jukebox |
| Property | Defined by | ||
|---|---|---|---|
| _currentChannel : SoundChannel [static]
| Jukebox | ||
| _currentSong : Sound [static]
| Jukebox | ||
| _eventMgr : EventHandlerManager [static]
| Jukebox | ||
| _frameDispatcher : IEventDispatcher [static]
| Jukebox | ||
| _loopCallback : Function = null [static]
| Jukebox | ||
| _sounds : Map [static]
| Jukebox | ||
| _volume : int = 30 [static]
| Jukebox | ||
| Method | Defined by | ||
|---|---|---|---|
|
fadeIn():void
[static]
Fade the current music in.
| Jukebox | ||
|
fadeOut():void
[static]
Fade the current music out.
| Jukebox | ||
|
init(frameDispatcher:IEventDispatcher, eventMgr:EventHandlerManager = null):void
[static]
init must be called before the Jukebox can handle crossfading and loading music correctly.
| Jukebox | ||
|
modifyVolume(by:int):int
[static]
Modify the current volume level by the given amount.
| Jukebox | ||
|
setVolume(volume:int):void
[static]
Set the volume level as a value between 0 and 100.
| Jukebox | ||
|
start(trackName:String, crossfade:Boolean = true, callback:Function = null):void
[static]
Start a background audio track.
| Jukebox | ||
|
stop():void
[static]
Stop playing the current music.
| Jukebox | ||
| Method | Defined by | ||
|---|---|---|---|
|
loop():void
[static]
| Jukebox | ||
|
soundComplete(event:Event):void
[static]
| Jukebox | ||
|
startSong(song:Sound, crossfade:Boolean):void
[static]
| Jukebox | ||
| Constant | Defined by | ||
|---|---|---|---|
| DEFAULT_VOLUME : int = 30 [static]
| Jukebox | ||
| MAX_VOLUME : int = 100 [static]
| Jukebox | ||
| Constant | Defined by | ||
|---|---|---|---|
| FADE_TIME : int = 3000 [static]
| Jukebox | ||
| _currentChannel | property |
protected static var _currentChannel:SoundChannel
| _currentSong | property |
protected static var _currentSong:Sound
| _eventMgr | property |
protected static var _eventMgr:EventHandlerManager
| _frameDispatcher | property |
protected static var _frameDispatcher:IEventDispatcher
| _loopCallback | property |
protected static var _loopCallback:Function = null
| _sounds | property |
protected static var _sounds:Map
| _volume | property |
protected static var _volume:int = 30
| fadeIn | () | method |
public static function fadeIn():voidFade the current music in. Used in crossfading or for fading in music after calling fadeOut().
| fadeOut | () | method |
public static function fadeOut():voidFade the current music out.
| init | () | method |
public static function init(frameDispatcher:IEventDispatcher, eventMgr:EventHandlerManager = null):voidinit must be called before the Jukebox can handle crossfading and loading music correctly. The frameDispatcher must be a display object that will remain on the display list, as this class depends on constant ENTER_FRAME events to function properly. If an EventHandlerManager is provided, all event listeners will be registered using it. Otherwise, EventHandlers is used statically.
ParametersframeDispatcher:IEventDispatcher |
|
eventMgr:EventHandlerManager (default = null) |
| loop | () | method |
protected static function loop():void
| modifyVolume | () | method |
public static function modifyVolume(by:int):intModify the current volume level by the given amount. This function will make sure the volume remains within the valid range of 0 to 100.
Parametersby:int |
int |
| setVolume | () | method |
public static function setVolume(volume:int):voidSet the volume level as a value between 0 and 100.
Parametersvolume:int |
| soundComplete | () | method |
protected static function soundComplete(event:Event):voidParameters
event:Event |
| start | () | method |
public static function start(trackName:String, crossfade:Boolean = true, callback:Function = null):voidStart a background audio track.
ParameterstrackName:String — the name of the level pack that contains the MP3 for this track.
|
|
crossfade:Boolean (default = true) — If true, this track will fade in, and any previous track will fade out. If
false, this track will begin playing immediately.
|
|
callback:Function (default = null) — A zero-arg function that will be called each time a loop of the current
song finishes and a new song is about to get played.
|
| startSong | () | method |
protected static function startSong(song:Sound, crossfade:Boolean):voidParameters
song:Sound |
|
crossfade:Boolean |
| stop | () | method |
public static function stop():voidStop playing the current music.
| DEFAULT_VOLUME | constant |
public static const DEFAULT_VOLUME:int = 30
| FADE_TIME | constant |
protected static const FADE_TIME:int = 3000
| MAX_VOLUME | constant |
public static const MAX_VOLUME:int = 100