Class Index | File Index

Classes


Class Stage


Extends Container.
A stage is the root level Container for a display list. Each time its tick method is called, it will render its display list to its target canvas.
Defined in: Stage.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Stage(canvas)
Constructs a Stage object with the specified target canvas.
Field Summary
Field Attributes Field Name and Description
 
Indicates whether the stage should automatically clear the canvas before each render.
 
The canvas the stage will render to.
 
READ-ONLY.
 
READ-ONLY.
 
The onMouseDown callback is called when the user presses the mouse button over the canvas.
 
The onMouseMove callback is called when the user moves the mouse over the canvas.
 
The onMouseUp callback is called when the user releases the mouse button anywhere that the page can detect it.
 
Indicates whether this stage should use the snapToPixel property of display objects when rendering them.
 
Calls the update method.
Fields borrowed from class Container:
children
Fields borrowed from class DisplayObject:
alpha, cacheCanvas, compositeOperation, id, mouseEnabled, name, onClick, onPress, parent, regX, regY, rotation, scaleX, scaleY, shadow, skewX, skewY, snapToPixel, visible, x, y
Method Summary
Method Attributes Method Name and Description
 
Clears the target canvas.
 
toDataURL(backgroundColor, mimeType)
Returns a data url that contains a Base64 encoded image of the contents of the stage.
 
Each time the update method is called, the stage will tick any descendants exposing a tick method (ex.
Methods borrowed from class Container:
addChild, addChildAt, clone, contains, getChildAt, getChildIndex, getNumChildren, getObjectsUnderPoint, getObjectUnderPoint, removeAllChildren, removeChild, removeChildAt, sortChildren
Methods borrowed from class DisplayObject:
cache, draw, getConcatenatedMatrix, getStage, globalToLocal, hitTest, isVisible, localToGlobal, localToLocal, toString, uncache, updateCache
Class Detail
Stage(canvas)
Constructs a Stage object with the specified target canvas.
Parameters:
canvas
The canvas the stage will render to.
Field Detail
autoClear
Indicates whether the stage should automatically clear the canvas before each render. You can set this to false to manually control clearing (for generative art, or when pointing multiple stages at the same canvas for example).

canvas
The canvas the stage will render to. Multiple stages can share a single canvas, but you must disable autoClear for all but the first stage that will be ticked (or they will clear each other's render).

mouseX
READ-ONLY. The current mouse X position on the canvas. If the mouse leaves the canvas, this will indicate the most recent position over the canvas.

mouseY
READ-ONLY. The current mouse Y position on the canvas. If the mouse leaves the canvas, this will indicate the most recent position over the canvas.

onMouseDown
The onMouseDown callback is called when the user presses the mouse button over the canvas. The handler is passed a single param containing the corresponding MouseEvent instance.

onMouseMove
The onMouseMove callback is called when the user moves the mouse over the canvas. The handler is passed a single param containing the corresponding MouseEvent instance.

onMouseUp
The onMouseUp callback is called when the user releases the mouse button anywhere that the page can detect it. The handler is passed a single param containing the corresponding MouseEvent instance.

snapToPixelEnabled
Indicates whether this stage should use the snapToPixel property of display objects when rendering them.

tick
Calls the update method. Useful for adding stage as a listener to Ticker directly.
Method Detail
clear()
Clears the target canvas. Useful if autoClear is set to false.

toDataURL(backgroundColor, mimeType)
Returns a data url that contains a Base64 encoded image of the contents of the stage. The returned data url can be specified as the src value of an image element.
Parameters:
backgroundColor
The background color to be used for the generated image. The value can be any value HTML color value, including HEX colors, rgb and rgba. The default value is a transparent background.
mimeType
The MIME type of the image format to be create. The default is "image/png". If an unknown MIME type is passed in, or if the browser does not support the specified MIME type, the default value will be used.
Returns:
a Base64 encoded image.

update()
Each time the update method is called, the stage will tick any descendants exposing a tick method (ex. BitmapSequence) and render its entire display list to the canvas.

Documentation generated by JsDoc Toolkit 2.3.2 on Sun Feb 13 2011 22:46:01 GMT-0700 (MST)