public class Stage
Package :
(default package)
Extends :
Description :
The overall DisplayObjectContainer. A stage is related to the <canvas> HTML element. It is the entry point to everything.
Methods :
public new()
Creates a new public Stage object.
public addArea(area)
Adding an invisible area.
Parameters :
- area : The area to add.
public addHtmlElement(elt)
Adding an HTML element to the stage.
Parameters :
- elt : The element to add.
private checkAreas()
Checking if areas need to dispatch an event.
private checkForUpdate()
Checks if the stage should be redrawn. If yes, enterFrame() is called.
public createControls(x, y)
Creating controls to replace arrow keys.
Parameters :
- x : The x coordinate.
- y : The y coordinate.
private createHtmlElementsContainer()
Creates an HTML node which will contain all future HTML elements. Thanks to this container, HTML elements' positions will be relative to the Stage top left corner.
public createLayer()
Adds a new layer to the stage (a new canvas element). This should be used for optimisation, or to have unsynchronized layers.
Returns :
The new Stage.
private createMouseEvent(evt)
Creating a MouseEvent using the native Javascript mouse event.
Parameters :
- evt : The native mouse event.
Returns :
The created MouseEvent.
private createTouchEvent(evt)
Creating a TouchEvent using the native Javascript touch event.
Parameters :
- evt : The native touch event.
Returns :
The created TouchEvent.
public enterFrame()
Entering a new frame.
public free()
Even when a stage is stopped, there is still a reference to it. This function allows the garbage collector to get rid of all this stage.
private getFocus()
Giving the focus to the stage.
public hide()
Hiding the stage. Also hides all HTML elements;
public removeArea(area)
Removing an invisible area.
Parameters :
- area : The area to remove.
public removeHtmlElement(elt)
Removing an HTML element from the stage.
Parameters :
- elt : The element to remove.
public show()
Showing the stage. Also re-enables all HTML elements.
public showStats()
Opens a popup displaying processing times.
public start()
Starting the stage (automatically called when created)
public static startAll()
Starting all stages.
public stop()
Stopping the stage automatic update
public static stopAll()
Stopping all stages.
private static updateStages()
Updates all stages. This method will only be called when creating the very first Stage (which is automatic).