| Package | org.flixel |
| Class | public class FlxSound |
| Inheritance | FlxSound FlxObject FlxRect FlxPoint Object |
| Property | Defined By | ||
|---|---|---|---|
![]() | acceleration : FlxPoint
How fast the speed of this object is changing. | FlxObject | |
![]() | active : Boolean
If an object is not alive, the game loop will not automatically call update() on it. | FlxObject | |
![]() | angle : Number
Set the angle of a sprite to rotate it. | FlxObject | |
![]() | angularAcceleration : Number
How fast the spin speed should change. | FlxObject | |
![]() | angularDrag : Number
Like drag but for spinning. | FlxObject | |
![]() | angularVelocity : Number
This is how fast you want this sprite to spin. | FlxObject | |
| artist : String
The ID3 artist name. | FlxSound | ||
![]() | bottom : Number [read-only]
The Y coordinate of the bottom of the rectangle. | FlxRect | |
![]() | colHullX : FlxRect
These store a couple of useful numbers for speeding up collision resolution. | FlxObject | |
![]() | colHullY : FlxRect
These store a couple of useful numbers for speeding up collision resolution. | FlxObject | |
![]() | collideBottom : Boolean
Flag for direction collision resolution. | FlxObject | |
![]() | collideLeft : Boolean
Flag for direction collision resolution. | FlxObject | |
![]() | collideRight : Boolean
Flag for direction collision resolution. | FlxObject | |
![]() | collideTop : Boolean
Flag for direction collision resolution. | FlxObject | |
![]() | colOffsets : Array
An array of FlxPoint objects. | FlxObject | |
![]() | colVector : FlxPoint
These store a couple of useful numbers for speeding up collision resolution. | FlxObject | |
![]() | dead : Boolean
Handy for tracking gameplay or animations. | FlxObject | |
![]() | drag : FlxPoint
This isn't drag exactly, more like deceleration that is only applied
when acceleration is not affecting the sprite. | FlxObject | |
![]() | exists : Boolean
Kind of a global on/off switch for any objects descended from FlxObject. | FlxObject | |
![]() | fixed : Boolean
If an object is 'fixed' in space, it will not budge when it collides with a not-fixed object. | FlxObject | |
![]() | _group : Boolean
Dedicated internal flag for whether or not this class is a FlxGroup. | FlxObject | |
![]() | health : Number
Handy for storing health percentage or armor points or whatever. | FlxObject | |
![]() | height : Number | FlxRect | |
![]() | left : Number [read-only]
The X coordinate of the left side of the rectangle. | FlxRect | |
![]() | maxAngular : Number
Use in conjunction with angularAcceleration for fluid spin speed control. | FlxObject | |
![]() | maxThrust : Number
Used to cap thrust, helpful and easy!
| FlxObject | |
![]() | maxVelocity : FlxPoint
If you are using acceleration, you can use maxVelocity with it
to cap the speed automatically (very useful!). | FlxObject | |
![]() | moves : Boolean
Set this to false if you want to skip the automatic motion/movement stuff (see updateMotion()). | FlxObject | |
| name : String
The ID3 song name. | FlxSound | ||
![]() | onFloor : Boolean
Flag that indicates whether or not you just hit the floor. | FlxObject | |
![]() | origin : FlxPoint
WARNING: The origin of the sprite will default to its center. | FlxObject | |
| playing : Boolean
Whether the sound is currently playing or not. | FlxSound | ||
![]() | right : Number [read-only]
The X coordinate of the right side of the rectangle. | FlxRect | |
![]() | scrollFactor : FlxPoint
A point that can store numbers from 0 to 1 (for X and Y independently)
that governs how much this object is affected by the camera subsystem. | FlxObject | |
![]() | solid : Boolean
If an object is dead, the functions that automate collisions will skip it (see FlxG.overlapArrays() and FlxG.collideArrays()). | FlxObject | |
| survive : Boolean
Whether or not this sound should be automatically destroyed when you switch states. | FlxSound | ||
![]() | thrust : Number
If you want to do Asteroids style stuff, check out thrust,
instead of directly accessing the object's velocity or acceleration. | FlxObject | |
![]() | top : Number [read-only]
The Y coordinate of the top of the rectangle. | FlxRect | |
![]() | velocity : FlxPoint
The basic speed of this object. | FlxObject | |
![]() | visible : Boolean
If an object is not visible, the game loop will not automatically call render() on it. | FlxObject | |
| volume : Number
Set volume to a value between 0 and 1 to change how this sound is. | FlxSound | ||
![]() | width : Number | FlxRect | |
![]() | x : Number | FlxPoint | |
![]() | y : Number | FlxPoint | |
| Property | Defined By | ||
|---|---|---|---|
| _channel : SoundChannel | FlxSound | ||
| _core : FlxObject | FlxSound | ||
| _fadeInTimer : Number | FlxSound | ||
| _fadeInTotal : Number | FlxSound | ||
| _fadeOutTimer : Number | FlxSound | ||
| _fadeOutTotal : Number | FlxSound | ||
![]() | _flashPoint : Point
This is a pre-allocated Flash Point object, which is useful for certain Flash graphics API calls
| FlxObject | |
![]() | _flicker : Boolean
Internal helper used for retro-style flickering. | FlxObject | |
![]() | _flickerTimer : Number
Internal helper used for retro-style flickering. | FlxObject | |
| _init : Boolean | FlxSound | ||
| _looped : Boolean | FlxSound | ||
| _pan : Boolean | FlxSound | ||
| _pauseOnFadeOut : Boolean | FlxSound | ||
![]() | _point : FlxPoint
This is just a pre-allocated x-y point container to be used however you like
| FlxObject | |
| _point2 : FlxPoint | FlxSound | ||
| _position : Number | FlxSound | ||
| _radius : Number | FlxSound | ||
![]() | _rect : FlxRect
This is just a pre-allocated rectangle container to be used however you like
| FlxObject | |
| _sound : Sound | 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 | ||
![]() | FlxObject | ||
destroy():void [override]
The basic class destructor, stops the music and removes any leftover events. | FlxSound | ||
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 | ||
![]() | flicker(Duration:Number = 1):void
Tells this object to flicker, retro-style. | FlxObject | |
![]() | flickering():Boolean
Check to see if the object is still flickering. | FlxObject | |
![]() |
Call this function to figure out the on-screen position of the object. | FlxObject | |
![]() |
Called when this object's bottom edge collides with the top of another FlxObject. | FlxObject | |
![]() |
Called when this object's left side collides with another FlxObject's right. | FlxObject | |
![]() |
Called when this object's right side collides with another FlxObject's left. | FlxObject | |
![]() |
Called when this object's top collides with the bottom of another FlxObject. | FlxObject | |
![]() | hurt(Damage:Number):void
Call this function to "damage" (or give health bonus) to this sprite. | FlxObject | |
![]() | kill():void
Call this function to "kill" a sprite so that it no longer 'exists'. | FlxObject | |
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 | ||
![]() | onScreen():Boolean
Check and see if this object is currently on screen. | FlxObject | |
![]() |
Checks to see if some FlxObject object overlaps this FlxObject object. | FlxObject | |
![]() | overlapsPoint(X:Number, Y:Number, PerPixel:Boolean = false):Boolean
Checks to see if a point in 2D space overlaps this FlxObject object. | FlxObject | |
pause():void
Call this function to pause this sound. | FlxSound | ||
play():void
Call this function to play the sound. | FlxSound | ||
![]() | preCollide(Object:FlxObject):void
FlxU.collide() (and thus FlxObject.collide()) call
this function each time two objects are compared to see if they collide. | FlxObject | |
Call this function if you want this sound's volume to change
based on distance from a particular FlxCore object. | FlxSound | ||
![]() | refreshHulls():void
Called by FlxObject.updateMotion() and some constructors to
rebuild the basic collision data for this object. | FlxObject | |
![]() | render():void
Override this function to draw graphics (see FlxSprite). | FlxObject | |
![]() | reset(X:Number, Y:Number):void
Handy function for reviving game objects. | FlxObject | |
stop():void
Call this function to stop this sound. | FlxSound | ||
![]() | toString():String
Convert object to readable string name. | FlxPoint | |
update():void [override]
The basic game loop update function. | FlxSound | ||
updateTransform():void
An internal function used to help organize and change the volume of the sound. | FlxSound | ||
| Method | Defined By | ||
|---|---|---|---|
gotID3(event:Event = null):void
Internal event handler for ID3 info (i.e. | FlxSound | ||
init():void
An internal function for clearing all the variables used by sounds. | 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 | ||
![]() | updateFlickering():void
Just updates the retro-style flickering. | FlxObject | |
![]() | updateMotion():void
Internal function for updating the position and speed of this object. | FlxObject | |
updateSound():void
Internal function that performs the actual logical updates to the sound object. | FlxSound | ||
| _channel | property |
protected var _channel:SoundChannel| _core | property |
protected var _core:FlxObject| _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| _transform | property |
protected var _transform:SoundTransform| _volume | property |
protected var _volume:Number| _volumeAdjust | property |
protected var _volumeAdjust:Number| artist | property |
public var artist:StringThe ID3 artist name. Defaults to null. Currently only works for streamed sounds.
| name | property |
public var name:StringThe ID3 song name. Defaults to null. Currently only works for streamed sounds.
| playing | property |
public var playing:BooleanWhether the sound is currently playing or not.
| survive | property |
public var survive:BooleanWhether 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| FlxSound | () | Constructor |
public function FlxSound()The FlxSound constructor gets all the variables initialized, but NOT ready to play a sound yet.
| destroy | () | method |
override public function destroy():voidThe 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):voidCall 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.
|
| gotID3 | () | method |
protected function gotID3(event:Event = null):voidInternal event handler for ID3 info (i.e. fetching the song name).
Parameters
event:Event (default = null) — An Event object.
|
| init | () | method |
protected function init():voidAn internal function for clearing all the variables used by sounds.
| loadEmbedded | () | method |
public function loadEmbedded(EmbeddedSound:Class, Looped:Boolean = false):FlxSoundOne 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):FlxSoundOne 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):voidAn internal helper function used to help Flash resume playing a looped sound.
Parameters
event:Event (default = null) — An Event object.
|
| pause | () | method |
public function pause():voidCall this function to pause this sound.
| play | () | method |
public function play():voidCall this function to play the sound.
| proximity | () | method |
public function proximity(X:Number, Y:Number, Core:FlxObject, Radius:Number, Pan:Boolean = true):FlxSoundCall 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.
| |
Core:FlxObject — The object you want to track.
| |
Radius:Number — The maximum distance this sound can travel.
| |
Pan:Boolean (default = true) |
FlxSound — This FlxSound instance (nice for chaining stuff together, if you're into that).
|
| stop | () | method |
public function stop():voidCall this function to stop this sound.
| stopped | () | method |
protected function stopped(event:Event = null):voidAn 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().
| updateSound | () | method |
protected function updateSound():voidInternal function that performs the actual logical updates to the sound object. Doesn't do much except optional proximity and fade calculations.
| updateTransform | () | method |
public function updateTransform():voidAn internal function used to help organize and change the volume of the sound.