| Package | com.whirled.contrib |
| Class | public class GameModeStack |
var mgr :GameModeStack = new GameModeStack(switchDisplayFn); mgr.push(new MainMenu()); ... // in the main menu, we decide to pick a level mgr.push(new LevelSelectorScreen()); ... // inside the level selector, we start the game: mgr.push(new GameScreen()); ... // inside the game screen, once it was won or lost: mgr.pop();
| Property | Defined by | ||
|---|---|---|---|
| _callback : Function Function that will be called every time the stack changes.
| GameModeStack | ||
| _stack : Array Internal storage for the stack.
| GameModeStack | ||
| Method | Defined by | ||
|---|---|---|---|
|
GameModeStack(callback:Function)
Constructor, receives a function to be called whenever the top of the stack changes.
| GameModeStack | ||
|
clear():void
Pops all items off the stack.
| GameModeStack | ||
|
Pops and returns the current top game mode from the stack.
| GameModeStack | ||
|
Pushes a new game mode on top of the stack.
| GameModeStack | ||
|
Returns the top of the mode stack.
| GameModeStack | ||
| _callback | property |
protected var _callback:FunctionFunction that will be called every time the stack changes.
| _stack | property |
protected var _stack:ArrayInternal storage for the stack.
| GameModeStack | () | constructor |
public function GameModeStack(callback:Function)Constructor, receives a function to be called whenever the top of the stack changes.
Parameterscallback:Function — Called whenever the top of the stack changes. Should be a function like:
function (previousTop :GameMode, newTop :GameMode) :void { }
- where previousTop is the mode previously selected, and newTop is the mode currently
selected (either can be null).
|
| clear | () | method |
public function clear():voidPops all items off the stack.
| pop | () | method |
public function pop():GameModePops and returns the current top game mode from the stack. Popping an empty stack is safe, it simply returns null.
ReturnsGameMode |
| push | () | method |
public function push(newMode:GameMode):voidPushes a new game mode on top of the stack.
ParametersnewMode:GameMode |
| top | () | method |
public function top():GameModeReturns the top of the mode stack. If the stack is empty, returns null.
ReturnsGameMode |