Package | org.flixel.system |
Class | public class FlxSound |
Inheritance | FlxSound ![]() ![]() |
Property | Defined By | ||
---|---|---|---|
![]() | active : Boolean
Controls whether update() is automatically called by FlxState/FlxGroup. | FlxBasic | |
![]() | _ACTIVECOUNT : uint [static] | FlxBasic | |
![]() | alive : Boolean
Useful state for many game objects - "dead" (!alive) vs alive. | FlxBasic | |
amplitude : Number
Stores the average wave amplitude of both stereo channels
| FlxSound | ||
amplitudeLeft : Number
Just the amplitude of the left stereo channel
| FlxSound | ||
amplitudeRight : Number
Just the amplitude of the left stereo channel
| FlxSound | ||
artist : String
The ID3 artist name. | FlxSound | ||
![]() | exists : Boolean
Controls whether update() and draw() are automatically called by FlxState/FlxGroup. | FlxBasic | |
![]() | ID : int
IDs seem like they could be pretty useful, huh?
| FlxBasic | |
name : String
The ID3 song name. | FlxSound | ||
survive : Boolean
Whether or not this sound should be automatically destroyed when you switch states. | FlxSound | ||
![]() | visible : Boolean
Controls whether draw() is automatically called by FlxState/FlxGroup. | FlxBasic | |
![]() | _VISIBLECOUNT : uint [static] | FlxBasic | |
volume : Number
Set volume to a value between 0 and 1 to change how this sound is. | FlxSound | ||
x : Number | FlxSound | ||
y : Number | FlxSound |
Property | Defined By | ||
---|---|---|---|
_amplitudeCallback : Function | FlxSound | ||
_amplitudeMonitor : FlxMonitor | FlxSound | ||
_amplitudeThreshold : Number | FlxSound | ||
_channel : SoundChannel | FlxSound | ||
_fadeInTimer : Number | FlxSound | ||
_fadeInTotal : Number | FlxSound | ||
_fadeOutTimer : Number | FlxSound | ||
_fadeOutTotal : Number | FlxSound | ||
_init : Boolean | FlxSound | ||
_looped : Boolean | FlxSound | ||
_pan : Boolean | FlxSound | ||
_pauseOnFadeOut : Boolean | FlxSound | ||
_point2 : FlxPoint | FlxSound | ||
_position : Number | FlxSound | ||
_radius : Number | FlxSound | ||
_sound : Sound | FlxSound | ||
_target : FlxObject | FlxSound | ||
_transform : SoundTransform | FlxSound | ||
_volume : Number | FlxSound | ||
_volumeAdjust : Number | FlxSound |
Method | Defined By | ||
---|---|---|---|
FlxSound()
The FlxSound constructor gets all the variables initialized, but NOT ready to play a sound yet. | FlxSound | ||
destroy():void [override]
The basic class destructor, stops the music and removes any leftover events. | FlxSound | ||
![]() | draw():void
Override this function to control how the object is drawn. | FlxBasic | |
fadeIn(Seconds:Number):void
Call this function to make a sound fade in over a certain
time interval (calls play() automatically). | FlxSound | ||
fadeOut(Seconds:Number, PauseInstead:Boolean = false):void
Call this function to make this sound fade out over a certain time interval. | FlxSound | ||
getActualVolume():Number | FlxSound | ||
![]() | kill():void | FlxBasic | |
loadEmbedded(EmbeddedSound:Class, Looped:Boolean = false):FlxSound
One of two main setup functions for sounds, this function loads a sound from an embedded MP3. | FlxSound | ||
loadStream(SoundURL:String, Looped:Boolean = false):FlxSound
One of two main setup functions for sounds, this function loads a sound from a URL. | FlxSound | ||
onBeat(Callback:Function, Threshold:Number = 0.12, SampleWindow:uint = 5):void | FlxSound | ||
![]() | FlxBasic | ||
pause():void
Call this function to pause this sound. | FlxSound | ||
play():void
Call this function to play the sound. | FlxSound | ||
![]() | postUpdate():void | FlxBasic | |
![]() | preUpdate():void | FlxBasic | |
Call this function if you want this sound's volume to change
based on distance from a particular FlxCore object. | FlxSound | ||
![]() | revive():void | FlxBasic | |
stop():void
Call this function to stop this sound. | FlxSound | ||
![]() | toString():String
Convert object to readable string name. | FlxBasic | |
update():void [override]
The basic game loop update function. | FlxSound | ||
updateTransform():void
Call after adjusting the volume to update the sound channel's settings. | FlxSound |
Method | Defined By | ||
---|---|---|---|
createSound():void
An internal function for clearing all the variables used by sounds. | FlxSound | ||
gotID3(event:Event = null):void
Internal event handler for ID3 info (i.e. | FlxSound | ||
looped(event:Event = null):void
An internal helper function used to help Flash resume playing a looped sound. | FlxSound | ||
stopped(event:Event = null):void
An internal helper function used to help Flash clean up and re-use finished sounds. | FlxSound |
_amplitudeCallback | property |
protected var _amplitudeCallback:Function
_amplitudeMonitor | property |
protected var _amplitudeMonitor:FlxMonitor
_amplitudeThreshold | property |
protected var _amplitudeThreshold:Number
_channel | property |
protected var _channel:SoundChannel
_fadeInTimer | property |
protected var _fadeInTimer:Number
_fadeInTotal | property |
protected var _fadeInTotal:Number
_fadeOutTimer | property |
protected var _fadeOutTimer:Number
_fadeOutTotal | property |
protected var _fadeOutTotal:Number
_init | property |
protected var _init:Boolean
_looped | property |
protected var _looped:Boolean
_pan | property |
protected var _pan:Boolean
_pauseOnFadeOut | property |
protected var _pauseOnFadeOut:Boolean
_point2 | property |
protected var _point2:FlxPoint
_position | property |
protected var _position:Number
_radius | property |
protected var _radius:Number
_sound | property |
protected var _sound:Sound
_target | property |
protected var _target:FlxObject
_transform | property |
protected var _transform:SoundTransform
_volume | property |
protected var _volume:Number
_volumeAdjust | property |
protected var _volumeAdjust:Number
amplitude | property |
public var amplitude:Number
Stores the average wave amplitude of both stereo channels
amplitudeLeft | property |
public var amplitudeLeft:Number
Just the amplitude of the left stereo channel
amplitudeRight | property |
public var amplitudeRight:Number
Just the amplitude of the left stereo channel
artist | property |
public var artist:String
The ID3 artist name. Defaults to null. Currently only works for streamed sounds.
name | property |
public var name:String
The ID3 song name. Defaults to null. Currently only works for streamed sounds.
survive | property |
public var survive:Boolean
Whether or not this sound should be automatically destroyed when you switch states.
volume | property |
volume:Number
Set volume
to a value between 0 and 1 to change how this sound is.
public function get volume():Number
public function set volume(value:Number):void
x | property |
public var x:Number
y | property |
public var y:Number
FlxSound | () | Constructor |
public function FlxSound()
The FlxSound constructor gets all the variables initialized, but NOT ready to play a sound yet.
createSound | () | method |
protected function createSound():void
An internal function for clearing all the variables used by sounds.
destroy | () | method |
override public function destroy():void
The basic class destructor, stops the music and removes any leftover events.
fadeIn | () | method |
public function fadeIn(Seconds:Number):void
Call this function to make a sound fade in over a certain
time interval (calls play()
automatically).
Parameters
Seconds:Number — The amount of time the fade-in operation should take.
|
fadeOut | () | method |
public function fadeOut(Seconds:Number, PauseInstead:Boolean = false):void
Call this function to make this sound fade out over a certain time interval.
Parameters
Seconds:Number — The amount of time the fade out operation should take.
| |
PauseInstead:Boolean (default = false ) — Tells the sound to pause on fadeout, instead of stopping.
|
getActualVolume | () | method |
public function getActualVolume():Number
ReturnsNumber |
gotID3 | () | method |
protected function gotID3(event:Event = null):void
Internal event handler for ID3 info (i.e. fetching the song name).
Parameters
event:Event (default = null ) — An Event object.
|
loadEmbedded | () | method |
public function loadEmbedded(EmbeddedSound:Class, Looped:Boolean = false):FlxSound
One of two main setup functions for sounds, this function loads a sound from an embedded MP3.
Parameters
EmbeddedSound:Class — An embedded Class object representing an MP3 file.
| |
Looped:Boolean (default = false ) — Whether or not this sound should loop endlessly.
|
FlxSound — This FlxSound instance (nice for chaining stuff together, if you're into that).
|
loadStream | () | method |
public function loadStream(SoundURL:String, Looped:Boolean = false):FlxSound
One of two main setup functions for sounds, this function loads a sound from a URL.
Parameters
SoundURL:String — A string representing the URL of the MP3 file you want to play.
| |
Looped:Boolean (default = false ) — Whether or not this sound should loop endlessly.
|
FlxSound — This FlxSound instance (nice for chaining stuff together, if you're into that).
|
looped | () | method |
protected function looped(event:Event = null):void
An internal helper function used to help Flash resume playing a looped sound.
Parameters
event:Event (default = null ) — An Event object.
|
onBeat | () | method |
public function onBeat(Callback:Function, Threshold:Number = 0.12, SampleWindow:uint = 5):void
Parameters
Callback:Function | |
Threshold:Number (default = 0.12 )
| |
SampleWindow:uint (default = 5 )
|
pause | () | method |
public function pause():void
Call this function to pause this sound.
play | () | method |
public function play():void
Call this function to play the sound.
proximity | () | method |
public function proximity(X:Number, Y:Number, Object:FlxObject, Radius:Number, Pan:Boolean = true):FlxSound
Call this function if you want this sound's volume to change based on distance from a particular FlxCore object.
Parameters
X:Number — The X position of the sound.
| |
Y:Number — The Y position of the sound.
| |
Object:FlxObject — The object you want to track.
| |
Radius:Number — The maximum distance this sound can travel.
| |
Pan:Boolean (default = true ) — Whether the sound should pan in addition to the volume changes (default: true).
|
FlxSound — This FlxSound instance (nice for chaining stuff together, if you're into that).
|
stop | () | method |
public function stop():void
Call this function to stop this sound.
stopped | () | method |
protected function stopped(event:Event = null):void
An internal helper function used to help Flash clean up and re-use finished sounds.
Parameters
event:Event (default = null ) — An Event object.
|
update | () | method |
override public function update():void
The basic game loop update function. Just calls updateSound()
.
updateTransform | () | method |
public function updateTransform():void
Call after adjusting the volume to update the sound channel's settings.