FlxSubState
is a special state that can be opened from within a FlxState
or another FlxSubState
.
When opened, a FlxSubState
will be displayed on top of all other states/substates, and only the top-most FlxSubState
will be responsive. By default, states below the top-most FlxSubState
will stop being updated, although you can change this behavior, if desired.
Use openSubState
to open a FlxSubState
, and close
to close it, giving control back to the parent FlxState
or FlxSubState
.
You can even define openCallback
and/or closeCallback
functions to be called when the FlxSubState
is opened or closed, respectively.
FlxSubState
is a versatile utility that can be used for in-game menus, pause screens, or other pop-up type screens.
// open and display a new sub-state from withing a FlxState or FlxSubState
openSubState(new MySubState());