Packageorg.flixel
Classpublic class FlxState
InheritanceFlxState Inheritance FlxGroup Inheritance FlxBasic Inheritance Object

This is the basic game "state" object - e.g. in a simple game you might have a menu state and a play state. It is for all intents and purpose a fancy FlxGroup. And really, it's not even that fancy.



Public Properties
 PropertyDefined By
 Inheritedactive : Boolean
Controls whether update() is automatically called by FlxState/FlxGroup.
FlxBasic
 Inherited_ACTIVECOUNT : uint
[static]
FlxBasic
 Inheritedalive : Boolean
Useful state for many game objects - "dead" (!alive) vs alive.
FlxBasic
 Inheritedcameras : Array
An array of camera objects that this object will use during draw().
FlxBasic
 Inheritedexists : Boolean
Controls whether update() and draw() are automatically called by FlxState/FlxGroup.
FlxBasic
 InheritedID : int
IDs seem like they could be pretty useful, huh? They're not actually used for anything yet though.
FlxBasic
 InheritedignoreDrawDebug : Boolean
Setting this to true will prevent the object from appearing when the visual debug mode in the debugger overlay is toggled on.
FlxBasic
 Inheritedlength : Number
The number of entries in the members array.
FlxGroup
 InheritedmaxSize : uint
The maximum capacity of this group.
FlxGroup
 Inheritedmembers : Array
Array of all the FlxBasics that exist in this group.
FlxGroup
 Inheritedvisible : Boolean
Controls whether draw() is automatically called by FlxState/FlxGroup.
FlxBasic
 Inherited_VISIBLECOUNT : uint
[static]
FlxBasic
Protected Properties
 PropertyDefined By
 Inherited_marker : uint
Internal helper variable for recycling objects a la FlxEmitter.
FlxGroup
 Inherited_maxSize : uint
Internal tracker for the maximum capacity of the group.
FlxGroup
 Inherited_sortIndex : String
Helper for sort.
FlxGroup
 Inherited_sortOrder : int
Helper for sort.
FlxGroup
Public Methods
 MethodDefined By
 Inherited
Adds a new FlxBasic subclass (FlxBasic, FlxSprite, Enemy, etc) to the group.
FlxGroup
 Inherited
callAll(FunctionName:String, Recurse:Boolean = true):void
Go through and call the specified function on all members of the group.
FlxGroup
 Inherited
clear():void
Remove all instances of FlxBasic subclass (FlxSprite, FlxBlock, etc) from the list.
FlxGroup
 Inherited
countDead():int
Call this function to find out how many members of the group are dead.
FlxGroup
 Inherited
Call this function to find out how many members of the group are not dead.
FlxGroup
  
create():void
This function is called after the game engine successfully switches states.
FlxState
 Inherited
destroy():void
[override] Override this function to handle any deleting or "shutdown" type operations you might need, such as removing traditional Flash children like Sprite objects.
FlxGroup
 Inherited
draw():void
[override] Automatically goes through and calls render on everything you added.
FlxGroup
 Inherited
drawDebug(Camera:FlxCamera = null):void
Override this function to draw custom "debug mode" graphics to the specified camera while the debugger's visual mode is toggled on.
FlxBasic
 Inherited
Call this function to retrieve the first object with dead == false in the group.
FlxGroup
 Inherited
getFirstAvailable(ObjectClass:Class = null):FlxBasic
Call this function to retrieve the first object with exists == false in the group.
FlxGroup
 Inherited
Call this function to retrieve the first object with dead == true in the group.
FlxGroup
 Inherited
Call this function to retrieve the first object with exists == true in the group.
FlxGroup
 Inherited
Call this function to retrieve the first index set to 'null'.
FlxGroup
 Inherited
getRandom(StartIndex:uint = 0, Length:uint = 0):FlxBasic
Returns a member at random from the group.
FlxGroup
 Inherited
kill():void
[override] Calls kill on the group's members and then on the group itself.
FlxGroup
 Inherited
postUpdate():void
Post-update is called right after update() on each object in the game loop.
FlxBasic
 Inherited
preUpdate():void
[override] Just making sure we don't increment the active objects count.
FlxGroup
 Inherited
recycle(ObjectClass:Class = null):FlxBasic
Recycling is designed to help you reuse game objects without always re-allocating or "newing" them.
FlxGroup
 Inherited
remove(Object:FlxBasic, Splice:Boolean = false):FlxBasic
Removes an object from the group.
FlxGroup
 Inherited
replace(OldObject:FlxBasic, NewObject:FlxBasic):FlxBasic
Replaces an existing FlxBasic with a new one.
FlxGroup
 Inherited
revive():void
Handy function for bringing game objects "back to life".
FlxBasic
 Inherited
setAll(VariableName:String, Value:Object, Recurse:Boolean = true):void
Go through and set the specified variable to the specified value on all members of the group.
FlxGroup
 Inherited
sort(Index:String = y, Order:int):void
Call this function to sort the group according to a particular value and order.
FlxGroup
 Inherited
toString():String
Convert object to readable string name.
FlxBasic
 Inherited
update():void
[override] Automatically goes through and calls update on everything you added.
FlxGroup
Protected Methods
 MethodDefined By
 Inherited
sortHandler(Obj1:FlxBasic, Obj2:FlxBasic):int
Helper function for the sort process.
FlxGroup
Public Constants
 ConstantDefined By
 InheritedASCENDING : int = -1
[static] Use with sort() to sort in ascending order.
FlxGroup
 InheritedDESCENDING : int = 1
[static] Use with sort() to sort in descending order.
FlxGroup
Method Detail
create()method
public function create():void

This function is called after the game engine successfully switches states. Override this function, NOT the constructor, to initialize or set up your game state. We do NOT recommend overriding the constructor, unless you want some crazy unpredictable things to happen!