#

API Documentation for: NEXT
Show: Inherited Protected Private Deprecated

# SpriteStage Class

Extends Stage
Defined in: `SpriteStage:46`
Module: EaselJS

A sprite stage is the root level Container for an aggressively optimized display list. Each time its tick method is called, it will render its display list to its target canvas. WebGL content is fully compatible with the existing Context2D renderer. On devices or browsers that don't support WebGL, content will automatically be rendered via canvas 2D.

Restrictions:

    - only Sprite, SpriteContainer, BitmapText, Bitmap and DOMElement are allowed to be added to the display list.
    - a child being added (with the exception of DOMElement) MUST have an image or spriteSheet defined on it.
    - a child's image/spriteSheet MUST never change while being on the display list.

#### Example

This example creates a sprite stage, adds a child to it, then uses Ticker to update the child and redraw the stage using update.

     var stage = new createjs.SpriteStage("canvasElementId", false, false);
     stage.updateViewport(800, 600);
     var image = new createjs.Bitmap("imagePath.png");
     stage.addChild(image);
     createjs.Ticker.addEventListener("tick", handleTick);
     function handleTick(event) {
         image.x += 10;
         stage.update();
     }

Note: SpriteStage is not included in the minified version of EaselJS.

## Constructor

### `SpriteStage`

(

- `canvas`
- `preserveDrawingBuffer`
- `antialias`

)

Defined in `SpriteStage:46`

#### Parameters:

- `canvas` HTMLCanvasElement | String | Object

  A canvas object that the SpriteStage will render to, or the string id of a canvas object in the current document.

- `preserveDrawingBuffer` Boolean

  If true, the canvas is NOT auto-cleared by WebGL (spec discourages true). Useful if you want to use p.autoClear = false.

- `antialias` Boolean

  Specifies whether or not the browser's WebGL implementation should try to perform antialiasing.

- Index
- Methods
- Properties
- Events

## Item Index

### Methods

- _applyFilterBounds
- _applyFilters
- _applyShadow
- _createBuffers
- _createShader
- _createShaderProgram
- _dispatchEvent
- _dispatchMouseEvent
- _drawToGPU
- _drawWebGLKids
- _getBounds
- _getElementRect
- _getObjectsUnderPoint
- _getPointerData
- _handleDoubleClick
- _handleMouseDown
- _handleMouseMove
- _handleMouseUp
- _handlePointerDown
- _handlePointerMove
- _handlePointerUp
- _initializeWebGL
- _initializeWebGLContext
- _isMouseOpaque
- _setClearColor
- _setMaxBoxesPoints
- _setUpKidTexture
- _setWebGLContext
- _testHit
- _testMouseOver
- _tick
- _transformBounds
- _updatePointerPosition
- addChild
- addChildAt
- addEventListener
- cache
- clear
- clearImageTexture
- clone
- cloneProps
- contains
- dispatchEvent
- draw
- enableDOMEvents
- enableMouseOver
- getBounds
- getCacheDataURL
- getChildAt
- getChildByName
- getChildIndex
- getConcatenatedMatrix
- getMatrix
- getNumChildren
- getObjectsUnderPoint
- getObjectUnderPoint
- getStage
- getTransformedBounds
- globalToLocal
- hasEventListener
- hitTest
- initialize
- isVisible
- localToGlobal
- localToLocal
- off
- on
- removeAllChildren
- removeAllEventListeners
- removeChild
- removeChildAt
- removeEventListener
- set
- setBounds
- setChildIndex
- setTransform
- sortChildren
- swapChildren
- swapChildrenAt
- tick
- toDataURL
- toString
- uncache
- update
- updateCache
- updateContext
- updateViewport
- willTrigger

### Properties

- _antialias
- _bounds
- _cacheDataURL
- _cacheDataURLID
- _cacheOffsetX
- _cacheOffsetY
- _cacheScale
- _captureListeners
- _clearColor
- _currentBoxIndex
- _drawTexture
- _indices
- _indicesBuffer
- _listeners
- _matrix
- _maxBoxesPerDraw
- _maxBoxesPointsPerDraw
- _maxIndicesPerDraw
- _maxTexturesPerDraw
- _mouseOverIntervalID
- _nextStage
- _pointerCount
- _pointerData
- _preserveDrawingBuffer
- _prevStage
- _primaryPointerID
- _projectionMatrix
- _rectangle
- _shaderProgram
- _vertices
- _verticesBuffer
- _viewportHeight
- _viewportWidth
- _webGLContext
- _webGLErrorDetected
- alpha
- autoClear
- cacheCanvas
- cacheID
- canvas
- children
- compositeOperation
- cursor
- DisplayObject__tick
- DisplayObject_draw
- DisplayObject_getBounds
- DisplayObject_initialize
- drawRect
- filters
- handleEvent
- hitArea
- id
- INDICES_PER_BOX static
- isWebGL
- mask
- MAX_BOXES_POINTS_INCREMENT static
- MAX_INDEX_SIZE static
- mouseChildren
- mouseEnabled
- mouseInBounds
- mouseMoveOutside
- mouseX
- mouseY
- name
- nextStage
- NUM_VERTEX_PROPERTIES static
- NUM_VERTEX_PROPERTIES_PER_BOX static
- onClick deprecated
- onDoubleClick deprecated
- onMouseDown deprecated
- onMouseMove deprecated
- onMouseOut deprecated
- onMouseOver deprecated
- onMouseUp deprecated
- onPress deprecated
- onTick deprecated
- parent
- POINTS_PER_BOX static
- regX
- regY
- rotation
- scaleX
- scaleY
- shadow
- skewX
- skewY
- snapToPixel
- snapToPixelEnabled
- Stage_draw
- Stage_initialize
- tickChildren
- tickEnabled
- tickOnUpdate
- visible
- x
- y

### Events

- click
- dblclick
- drawend
- drawstart
- mousedown
- mouseenter
- mouseleave
- mouseout
- mouseover
- pressmove
- pressup
- rollout
- rollover
- stagemousedown
- stagemousemove
- stagemouseup
- tick
- tickend
- tickstart

## Methods

### `_applyFilterBounds`

(

- `x`
- `y`
- `width`
- `height`

)
Rectangle protected

Inherited from DisplayObject: `_applyFilterBounds:1281`

#### Parameters:

- `x` Number
- `y` Number
- `width` Number
- `height` Number

#### Returns:

Rectangle:

### `_applyFilters`

() protected

Inherited from DisplayObject: `_applyFilters:1266`

### `_applyShadow`

(

- `ctx`
- `shadow`

)
protected

Inherited from DisplayObject: `_applyShadow:1218`

#### Parameters:

- `ctx` CanvasRenderingContext2D
- `shadow` Shadow

### `_createBuffers`

(

- `ctx`

)
protected

Defined in `_createBuffers:773`

Sets up the necessary vertices and indices buffers.

#### Parameters:

- `ctx` WebGLRenderingContext

### `_createShader`

(

- `ctx`
- `type`
- `str`

)
WebGLShader protected

Defined in `_createShader:750`

Creates a shader from the specified string.

#### Parameters:

- `ctx` WebGLRenderingContext
- `type` Number

  The type of shader to create.

- `str` String

  The definition for the shader.

#### Returns:

WebGLShader:

### `_createShaderProgram`

(

- `ctx`

)
protected

Defined in `_createShaderProgram:685`

Creates the shader program that's going to be used to draw everything.

#### Parameters:

- `ctx` WebGLRenderingContext

### `_dispatchEvent`

(

- `eventObj`
- `eventPhase`

)
protected

Inherited from EventDispatcher: `_dispatchEvent:369`

#### Parameters:

- `eventObj` Object | String | Event
- `eventPhase` Object

### `_dispatchMouseEvent`

(

- `target`
- `type`
- `bubbles`
- `pointerId`
- `o`
- `[nativeEvent]`

)
protected

Inherited from Stage: `_dispatchMouseEvent:898`

#### Parameters:

- `target` DisplayObject
- `type` String
- `bubbles` Boolean
- `pointerId` Number
- `o` Object
- `[nativeEvent]` MouseEvent optional

### `_drawToGPU`

(

- `ctx`

)
protected

Defined in `_drawToGPU:1009`

Draws all the currently defined boxes to the GPU.

#### Parameters:

- `ctx` WebGLRenderingContext

  The canvas WebGL context object to draw into.

### `_drawWebGLKids`

(

- `kids`
- `ctx`
- `parentMVMatrix`

)
protected

Defined in `_drawWebGLKids:863`

Draw all the kids into the WebGL context.

#### Parameters:

- `kids` Array

  The list of kids to draw.

- `ctx` WebGLRenderingContext

  The canvas WebGL context object to draw into.

- `parentMVMatrix` Matrix2D

  The parent's global transformation matrix.

### `_getBounds`

(

- `matrix`
- `ignoreTransform`

)
Rectangle protected

Inherited from DisplayObject but overwritten in `_getBounds:632`

#### Parameters:

- `matrix` Matrix2D
- `ignoreTransform` Boolean

  If true, does not apply this object's transform.

#### Returns:

Rectangle:

### `_getElementRect`

(

- `e`

)
protected

Inherited from Stage: `_getElementRect:625`

#### Parameters:

- `e` HTMLElement

### `_getObjectsUnderPoint`

(

- `x`
- `y`
- `arr`
- `mouse`
- `activeListener`

)
Array protected

Inherited from Container: `_getObjectsUnderPoint:568`

#### Parameters:

- `x` Number
- `y` Number
- `arr` Array
- `mouse` Boolean

  If true, it will respect mouse interaction properties like mouseEnabled, mouseChildren, and active listeners.

- `activeListener` Boolean

  If true, there is an active mouse event listener.

#### Returns:

Array:

### `_getPointerData`

(

- `id`

)
protected

Inherited from Stage: `_getPointerData:653`

#### Parameters:

- `id` Number

### `_handleDoubleClick`

(

- `e`
- `owner`

)
protected

Inherited from Stage: `_handleDoubleClick:883`

#### Parameters:

- `e` MouseEvent
- `owner` Stage

  Indicates that the event has already been captured & handled by the indicated stage.

### `_handleMouseDown`

(

- `e`

)
protected

Inherited from Stage: `_handleMouseDown:781`

#### Parameters:

- `e` MouseEvent

### `_handleMouseMove`

(

- `e`

)
protected

Inherited from Stage: `_handleMouseMove:670`

#### Parameters:

- `e` MouseEvent

### `_handleMouseUp`

(

- `e`

)
protected

Inherited from Stage: `_handleMouseUp:745`

#### Parameters:

- `e` MouseEvent

### `_handlePointerDown`

(

- `id`
- `e`
- `pageX`
- `pageY`
- `owner`

)
protected

Inherited from Stage: `_handlePointerDown:790`

#### Parameters:

- `id` Number
- `e` Event
- `pageX` Number
- `pageY` Number
- `owner` Stage

  Indicates that the event has already been captured & handled by the indicated stage.

### `_handlePointerMove`

(

- `id`
- `e`
- `pageX`
- `pageY`
- `owner`

)
protected

Inherited from Stage: `_handlePointerMove:680`

#### Parameters:

- `id` Number
- `e` Event
- `pageX` Number
- `pageY` Number
- `owner` Stage

  Indicates that the event has already been captured & handled by the indicated stage.

### `_handlePointerUp`

(

- `id`
- `e`
- `clear`
- `owner`

)
protected

Inherited from Stage: `_handlePointerUp:754`

#### Parameters:

- `id` Number
- `e` Event
- `clear` Boolean
- `owner` Stage

  Indicates that the event has already been captured & handled by the indicated stage.

### `_initializeWebGL`

() protected

Defined in `_initializeWebGL:586`

Initializes rendering with WebGL using the current canvas element.

### `_initializeWebGLContext`

() protected

Defined in `_initializeWebGLContext:616`

Sets up the WebGL context for rendering.

### `_isMouseOpaque`

() Boolean protected

Inherited from DisplayObject: `_isMouseOpaque:1351`

Indicates whether the display object has any mouse event listeners or a cursor.

#### Returns:

Boolean:

### `_setClearColor`

(

- `r`
- `g`
- `b`
- `a`

)
protected

Defined in `_setClearColor:665`

Sets the color to use when the WebGL canvas has been cleared.

#### Parameters:

- `r` Number

  A number between 0 and 1.

- `g` Number

  A number between 0 and 1.

- `b` Number

  A number between 0 and 1.

- `a` Number

  A number between 0 and 1.

### `_setMaxBoxesPoints`

(

- `ctx`
- `value`

)
protected

Defined in `_setMaxBoxesPoints:792`

Updates the maximum total number of boxes points that can be defined per draw call, and updates the buffers with the new array length sizes.

#### Parameters:

- `ctx` WebGLRenderingContext
- `value` Number

  The new this._maxBoxesPointsPerDraw value.

### `_setUpKidTexture`

(

- `ctx`
- `kid`

)
WebGLTexture protected

Defined in `_setUpKidTexture:826`

Sets up a kid's WebGL texture.

#### Parameters:

- `ctx` WebGLRenderingContext

  The canvas WebGL context object to draw into.

- `kid` Object

  The list of kids to draw.

#### Returns:

WebGLTexture:

### `_setWebGLContext`

() WebGLRenderingContext protected

Defined in `_setWebGLContext:597`

Sets the WebGL context to use for future draws.

#### Returns:

WebGLRenderingContext:

The newly created context.

### `_testHit`

(

- `ctx`

)
Boolean protected

Inherited from DisplayObject: `_testHit:1249`

#### Parameters:

- `ctx` CanvasRenderingContext2D

#### Returns:

Boolean:

### `_testMouseOver`

(

- `clear`
- `owner`
- `eventTarget`

)
protected

Inherited from Stage: `_testMouseOver:814`

#### Parameters:

- `clear` Boolean

  If true, clears the mouseover / rollover (ie. no target)

- `owner` Stage

  Indicates that the event has already been captured & handled by the indicated stage.

- `eventTarget` Stage

  The stage that the cursor is actively over.

### `_tick`

(

- `props`

)
protected

Inherited from DisplayObject but overwritten in `_tick:552`

#### Parameters:

- `props` Object

  Properties to copy to the DisplayObject DisplayObject/tick event object. function.

### `_transformBounds`

(

- `bounds`
- `matrix`
- `ignoreTransform`

)
Rectangle protected

Inherited from DisplayObject: `_transformBounds:1318`

#### Parameters:

- `bounds` Rectangle
- `matrix` Matrix2D
- `ignoreTransform` Boolean

#### Returns:

Rectangle:

### `_updatePointerPosition`

(

- `id`
- `e`
- `pageX`
- `pageY`

)
protected

Inherited from Stage: `_updatePointerPosition:708`

#### Parameters:

- `id` Number
- `e` Event
- `pageX` Number
- `pageY` Number

### `addChild`

(

- `child`

)
DisplayObject

Inherited from Container but overwritten in `addChild:374`

Adds a child to the top of the display list. Only children of type SpriteContainer, Sprite, Bitmap, BitmapText, or DOMElement are allowed. Children also MUST have either an image or spriteSheet defined on them (unless it's a DOMElement).

#### Example

container.addChild(bitmapInstance);

You can also add multiple children at once:

     container.addChild(bitmapInstance, shapeInstance, textInstance);

#### Parameters:

- `child` DisplayObject

  The display object to add.

#### Returns:

DisplayObject:

The child that was added, or the last child if multiple children were added.

### `addChildAt`

(

- `child`
- `index`

)
DisplayObject

Inherited from Container but overwritten in `addChildAt:399`

Adds a child to the display list at the specified index, bumping children at equal or greater indexes up one, and setting its parent to this Container. Only children of type SpriteContainer, Sprite, Bitmap, BitmapText, or DOMElement are allowed. Children also MUST have either an image or spriteSheet defined on them (unless it's a DOMElement).

#### Example

     addChildAt(child1, index);

You can also add multiple children, such as:

     addChildAt(child1, child2, ..., index);

The index must be between 0 and numChildren. For example, to add myShape under otherShape in the display list, you could use:

     container.addChildAt(myShape, container.getChildIndex(otherShape));

This would also bump otherShape's index up by one. Fails silently if the index is out of range.

#### Parameters:

- `child` DisplayObject

  The display object to add.

- `index` Number

  The index to add the child at.

#### Returns:

DisplayObject:

Returns the last child that was added, or the last child if multiple children were added.

### `addEventListener`

(

- `type`
- `listener`
- `[useCapture]`

)
Function | Object

Inherited from EventDispatcher: `addEventListener:142`

Adds the specified event listener. Note that adding multiple listeners to the same function will result in multiple callbacks getting fired.

#### Example

     displayObject.addEventListener("click", handleClick);
     function handleClick(event) {
        // Click happened.
     }

#### Parameters:

- `type` String

  The string type of the event.

- `listener` Function | Object

  An object with a handleEvent method, or a function that will be called when the event is dispatched.

- `[useCapture]` Boolean optional

  For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.

#### Returns:

Function | Object:

Returns the listener for chaining or assignment.

### `cache`

(

- `x`
- `y`
- `width`
- `height`
- `[scale=1]`

)

Inherited from DisplayObject: `cache:741`

Draws the display object into a new canvas, which is then used for subsequent draws. For complex content that does not change frequently (ex. a Container with many children that do not move, or a complex vector Shape), this can provide for much faster rendering because the content does not need to be re-rendered each tick. The cached display object can be moved, rotated, faded, etc freely, however if its content changes, you must manually update the cache by calling `updateCache()` or `cache()` again. You must specify the cache area via the x, y, w, and h parameters. This defines the rectangle that will be rendered and cached using this display object's coordinates.

#### Example

For example if you defined a Shape that drew a circle at 0, 0 with a radius of 25:

     var shape = new createjs.Shape();
     shape.graphics.beginFill("#ff0000").drawCircle(0, 0, 25);
     myShape.cache(-25, -25, 50, 50);

Note that filters need to be defined before the cache is applied. Check out the Filter class for more information. Some filters (ex. BlurFilter) will not work as expected in conjunction with the scale param.

Usually, the resulting cacheCanvas will have the dimensions widthscale by heightscale, however some filters (ex. BlurFilter) will add padding to the canvas dimensions.

#### Parameters:

- `x` Number

  The x coordinate origin for the cache region.

- `y` Number

  The y coordinate origin for the cache region.

- `width` Number

  The width of the cache region.

- `height` Number

  The height of the cache region.

- `[scale=1]` Number optional

  The scale at which the cache will be created. For example, if you cache a vector shape using myShape.cache(0,0,100,100,2) then the resulting cacheCanvas will be 200x200 px. This lets you scale and rotate cached elements with greater fidelity. Default is 1.

### `clear`

()

Inherited from Stage but overwritten in `clear:493`

Clears the target canvas. Useful if autoClear is set to `false`.

### `clearImageTexture`

(

- `image`

)

Defined in `clearImageTexture:566`

Clears an image's texture to free it up for garbage collection.

#### Parameters:

- `image` Image

### `clone`

() Stage

Inherited from DisplayObject but overwritten in `clone:603`

Returns a clone of this Stage.

#### Returns:

Stage:

A clone of the current Container instance.

### `cloneProps`

(

- `o`

)
protected

Inherited from DisplayObject: `cloneProps:1193`

#### Parameters:

- `o` DisplayObject

  The DisplayObject instance which will have properties from the current DisplayObject instance copied into.

### `contains`

(

- `child`

)
Boolean

Inherited from Container: `contains:427`

Returns true if the specified display object either is this container or is a descendent (child, grandchild, etc) of this container.

#### Parameters:

- `child` DisplayObject

  The DisplayObject to be checked.

#### Returns:

Boolean:

true if the specified display object either is this container or is a descendent.

### `dispatchEvent`

(

- `eventObj`
- `[target]`

)
Boolean

Inherited from EventDispatcher: `dispatchEvent:280`

Dispatches the specified event to all listeners.

#### Example

     // Use a string event
     this.dispatchEvent("complete");

     // Use an Event instance
     var event = new createjs.Event("progress");
     this.dispatchEvent(event);

#### Parameters:

- `eventObj` Object | String | Event

  An object with a "type" property, or a string type. While a generic object will work, it is recommended to use a CreateJS Event instance. If a string is used, dispatchEvent will construct an Event instance with the specified type.

- `[target]` Object optional

  The object to use as the target property of the event object. This will default to the dispatching object. This parameter is deprecated and will be removed.

#### Returns:

Boolean:

Returns the value of eventObj.defaultPrevented.

### `draw`

(

- `ctx`
- `[ignoreCache=false]`

)

Inherited from DisplayObject but overwritten in `draw:518`

Draws the stage into the specified context (using WebGL) ignoring its visible, alpha, shadow, and transform. If WebGL is not supported in the browser, it will default to a 2D context. Returns true if the draw was handled (useful for overriding functionality).

NOTE: This method is mainly for internal use, though it may be useful for advanced uses.

#### Parameters:

- `ctx` CanvasRenderingContext2D

  The canvas 2D context object to draw into.

- `[ignoreCache=false]` Boolean optional

  Indicates whether the draw operation should ignore any current cache. For example, used for drawing the cache (to prevent it from simply drawing an existing cache back into itself).

### `enableDOMEvents`

(

- `[enable=true]`

)

Inherited from Stage: `enableDOMEvents:563`

Enables or disables the event listeners that stage adds to DOM elements (window, document and canvas). It is good practice to disable events when disposing of a Stage instance, otherwise the stage will continue to receive events from the page.

When changing the canvas property you must disable the events on the old canvas, and enable events on the new canvas or mouse events will not work as expected. For example:

     myStage.enableDOMEvents(false);
     myStage.canvas = anotherCanvas;
     myStage.enableDOMEvents(true);

#### Parameters:

- `[enable=true]` Boolean optional

  Indicates whether to enable or disable the events. Default is true.

### `enableMouseOver`

(

- `[frequency=20]`

)

Inherited from Stage: `enableMouseOver:532`

Enables or disables (by passing a frequency of 0) mouse over (mouseover and mouseout) and roll over events (rollover and rollout) for this stage's display list. These events can be expensive to generate, so they are disabled by default. The frequency of the events can be controlled independently of mouse move events via the optional `frequency` parameter.

#### Example

     var stage = new createjs.Stage("canvasId");
     stage.enableMouseOver(10); // 10 updates per second

#### Parameters:

- `[frequency=20]` Number optional

  Optional param specifying the maximum number of times per second to broadcast mouse over/out events. Set to 0 to disable mouse over events completely. Maximum is 50. A lower frequency is less responsive, but uses less CPU.

### `getBounds`

() Rectangle

Inherited from DisplayObject: `getBounds:1066`

Returns a rectangle representing this object's bounds in its local coordinate system (ie. with no transformation). Objects that have been cached will return the bounds of the cache.

Not all display objects can calculate their own bounds (ex. Shape). For these objects, you can use setBounds so that they are included when calculating Container bounds.

All | All display objects support setting bounds manually using setBounds(). Likewise, display objects that have been cached using cache() will return the bounds of their cache. Manual and cache bounds will override the automatic calculations listed below.
Bitmap | Returns the width and height of the sourceRect (if specified) or image, extending from (x=0,y=0).
Sprite | Returns the bounds of the current frame. May have non-zero x/y if a frame registration point was specified in the spritesheet data. See also getFrameBounds
Container | Returns the aggregate (combined) bounds of all children that return a non-null value from getBounds().
Shape | Does not currently support automatic bounds calculations. Use setBounds() to manually define bounds.
Text | Returns approximate bounds. Horizontal values (x/width) are quite accurate, but vertical values (y/height) are not, especially when using textBaseline values other than "top".
BitmapText | Returns approximate bounds. Values will be more accurate if spritesheet frame registration points are close to (x=0,y=0).

Bounds can be expensive to calculate for some objects (ex. text, or containers with many children), and are recalculated each time you call getBounds(). You can prevent recalculation on static objects by setting the bounds explicitly:

    var bounds = obj.getBounds();
    obj.setBounds(bounds.x, bounds.y, bounds.width, bounds.height);
    // getBounds will now use the set values, instead of recalculating

To reduce memory impact, the returned Rectangle instance may be reused internally; clone the instance or copy its values if you need to retain it.

    var myBounds = obj.getBounds().clone();
    // OR:
    myRect.copy(obj.getBounds());

#### Returns:

Rectangle:

A Rectangle instance representing the bounds, or null if bounds are not available for this object.

### `getCacheDataURL`

() String

Inherited from DisplayObject: `getCacheDataURL:847`

Returns a data URL for the cache, or null if this display object is not cached. Uses cacheID to ensure a new data URL is not generated if the cache has not changed.

#### Returns:

String:

The image data url for the cache.

### `getChildAt`

(

- `index`

)
DisplayObject

Inherited from Container: `getChildAt:302`

Returns the child at the specified index.

#### Example

     container.getChildAt(2);

#### Parameters:

- `index` Number

  The index of the child to return.

#### Returns:

DisplayObject:

The child at the specified index. Returns null if there is no child at the index.

### `getChildByName`

(

- `name`

)
DisplayObject

Inherited from Container: `getChildByName:317`

Returns the child with the specified name.

#### Parameters:

- `name` String

  The name of the child to return.

#### Returns:

DisplayObject:

The child with the specified name.

### `getChildIndex`

(

- `child`

)
Number

Inherited from Container: `getChildIndex:351`

Returns the index of the specified child in the display list, or -1 if it is not in the display list.

#### Example

     var index = container.getChildIndex(child);

#### Parameters:

- `child` DisplayObject

  The child to return the index of.

#### Returns:

Number:

The index of the specified child. -1 if the child is not found.

### `getConcatenatedMatrix`

(

- `[matrix]`

)
Matrix2D

Inherited from DisplayObject: `getConcatenatedMatrix:996`

Generates a concatenated Matrix2D object representing the combined transform of the display object and all of its parent Containers up to the highest level ancestor (usually the Stage). This can be used to transform positions between coordinate spaces, such as with localToGlobal and globalToLocal.

#### Parameters:

- `[matrix]` Matrix2D optional

  A Matrix2D object to populate with the calculated values. If null, a new Matrix2D object is returned.

#### Returns:

Matrix2D:

a concatenated Matrix2D object representing the combined transform of the display object and all of its parent Containers up to the highest level ancestor (usually the Stage).

### `getMatrix`

(

- `matrix`

)
Matrix2D

Inherited from DisplayObject: `getMatrix:984`

Returns a matrix based on this object's transform.

#### Parameters:

- `matrix` Matrix2D

  Optional. A Matrix2D object to populate with the calculated values. If null, a new Matrix object is returned.

#### Returns:

Matrix2D:

A matrix representing this display object's transform.

### `getNumChildren`

() Number

Inherited from Container: `getNumChildren:366`

Returns the number of children in the display list.

#### Returns:

Number:

The number of children in the display list.

### `getObjectsUnderPoint`

(

- `x`
- `y`

)
Array

Inherited from Container: `getObjectsUnderPoint:457`

Returns an array of all display objects under the specified coordinates that are in this container's display list. This routine ignores any display objects with mouseEnabled set to false. The array will be sorted in order of visual depth, with the top-most display object at index 0. This uses shape based hit detection, and can be an expensive operation to run, so it is best to use it carefully. For example, if testing for objects under the mouse, test on tick (instead of on mousemove), and only if the mouse's position has changed.

Accounts for both hitArea and mask.

#### Parameters:

- `x` Number

  The x position in the container to test.

- `y` Number

  The y position in the container to test.

#### Returns:

Array:

An Array of DisplayObjects under the specified coordinates.

### `getObjectUnderPoint`

(

- `x`
- `y`

)
DisplayObject

Inherited from Container: `getObjectUnderPoint:477`

Similar to Container/getObjectsUnderPoint(), but returns only the top-most display object. This runs significantly faster than `getObjectsUnderPoint()`, but is still an expensive operation. See getObjectsUnderPoint for more information.``

#### Parameters:

- `x` Number

  The x position in the container to test.

- `y` Number

  The y position in the container to test.

#### Returns:

DisplayObject:

The top-most display object under the specified coordinates.

### `getStage`

() Stage

Inherited from DisplayObject: `getStage:859`

Returns the stage that this display object will be rendered on, or null if it has not been added to one.

#### Returns:

Stage:

The Stage instance that the display object is a descendent of. null if the DisplayObject has not been added to a Stage.

### `getTransformedBounds`

() Rectangle

Inherited from DisplayObject: `getTransformedBounds:1132`

Returns a rectangle representing this object's bounds in its parent's coordinate system (ie. with transformations applied). Objects that have been cached will return the transformed bounds of the cache.

Not all display objects can calculate their own bounds (ex. Shape). For these objects, you can use setBounds so that they are included when calculating Container bounds.

To reduce memory impact, the returned Rectangle instance may be reused internally; clone the instance or copy its values if you need to retain it.

Container instances calculate aggregate bounds for all children that return bounds via getBounds.

#### Returns:

Rectangle:

A Rectangle instance representing the bounds, or null if bounds are not available for this object.

### `globalToLocal`

(

- `x`
- `y`

)
Point

Inherited from DisplayObject: `globalToLocal:902`

Transforms the specified x and y position from the global (stage) coordinate space to the coordinate space of the display object. For example, this could be used to determine the current mouse position within the display object. Returns a Point instance with x and y properties correlating to the transformed position in the display object's coordinate space.

#### Example

     displayObject.x = 300;
     displayObject.y = 200;
     stage.addChild(displayObject);
     var point = myDisplayObject.globalToLocal(100, 100);
     // Results in x=-200, y=-100

#### Parameters:

- `x` Number

  The x position on the stage to transform.

- `y` Number

  The y position on the stage to transform.

#### Returns:

Point:

A Point instance with x and y properties correlating to the transformed position in the display object's coordinate space.

### `hasEventListener`

(

- `type`

)
Boolean

Inherited from EventDispatcher: `hasEventListener:329`

Indicates whether there is at least one listener for the specified event type.

#### Parameters:

- `type` String

  The string type of the event.

#### Returns:

Boolean:

Returns true if there is at least one listener for the specified event.

### `hitTest`

(

- `x`
- `y`

)
Boolean

Inherited from DisplayObject but overwritten in `hitTest:442`

Tests whether the display object intersects the specified local point (ie. draws a pixel with alpha > 0 at the specified position). This ignores the alpha, shadow and compositeOperation of the display object, and all transform properties including regX/Y.

#### Parameters:

- `x` Number

  The x position to check in the display object's local coordinates.

- `y` Number

  The y position to check in the display object's local coordinates.

#### Returns:

Boolean:

A Boolean indicating whether there is a visible section of a DisplayObject that overlaps the specified coordinates.

### `initialize`

(

- `canvas`
- `preserveDrawingBuffer`
- `antialias`

)
protected

Inherited from EventDispatcher but overwritten in `initialize:356`

Initialization method.

#### Parameters:

- `canvas` HTMLCanvasElement | String | Object

  A canvas object, or the string id of a canvas object in the current document.

- `preserveDrawingBuffer` Boolean

  If true, the canvas is NOT auto-cleared by WebGL (spec discourages true). Useful if you want to use p.autoClear = false.

- `antialias` Boolean

  Specifies whether or not the browser's WebGL implementation should try to perform antialiasing.

### `isVisible`

() Boolean

Inherited from DisplayObject but overwritten in `isVisible:113`

Returns true or false indicating whether the display object would be visible if drawn to a canvas. This does not account for whether it would be visible within the boundaries of the stage.

NOTE: This method is mainly for internal use, though it may be useful for advanced uses.

#### Returns:

Boolean:

Boolean indicating whether the display object would be visible if drawn to a canvas

### `localToGlobal`

(

- `x`
- `y`

)
Point

Inherited from DisplayObject: `localToGlobal:875`

Transforms the specified x and y position from the coordinate space of the display object to the global (stage) coordinate space. For example, this could be used to position an HTML label over a specific point on a nested display object. Returns a Point instance with x and y properties correlating to the transformed coordinates on the stage.

#### Example

     displayObject.x = 300;
     displayObject.y = 200;
     stage.addChild(displayObject);
     var point = myDisplayObject.localToGlobal(100, 100);
     // Results in x=400, y=300

#### Parameters:

- `x` Number

  The x position in the source display object to transform.

- `y` Number

  The y position in the source display object to transform.

#### Returns:

Point:

A Point instance with x and y properties correlating to the transformed coordinates on the stage.

### `localToLocal`

(

- `x`
- `y`
- `target`

)
Point

Inherited from DisplayObject: `localToLocal:930`

Transforms the specified x and y position from the coordinate space of this display object to the coordinate space of the target display object. Returns a Point instance with x and y properties correlating to the transformed position in the target's coordinate space. Effectively the same as using the following code with localToGlobal and globalToLocal.

     var pt = this.localToGlobal(x, y);
     pt = target.globalToLocal(pt.x, pt.y);

#### Parameters:

- `x` Number

  The x position in the source display object to transform.

- `y` Number

  The y position on the source display object to transform.

- `target` DisplayObject

  The target display object to which the coordinates will be transformed.

#### Returns:

Point:

Returns a Point instance with x and y properties correlating to the transformed position in the target's coordinate space.

### `off`

(

- `type`
- `listener`
- `[useCapture]`

)

Inherited from EventDispatcher: `off:247`

A shortcut to the removeEventListener method, with the same parameters and return value. This is a companion to the .on method.

#### Parameters:

- `type` String

  The string type of the event.

- `listener` Function | Object

  The listener function or object.

- `[useCapture]` Boolean optional

  For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.

### `on`

(

- `type`
- `listener`
- `[scope]`
- `[once=false]`
- `[data]`
- `[useCapture=false]`

)
Function

Inherited from EventDispatcher: `on:175`

A shortcut method for using addEventListener that makes it easier to specify an execution scope, have a listener only run once, associate arbitrary data with the listener, and remove the listener.

This method works by creating an anonymous wrapper function and subscribing it with addEventListener. The created anonymous function is returned for use with .removeEventListener (or .off).

#### Example

        var listener = myBtn.on("click", handleClick, null, false, {count:3});
        function handleClick(evt, data) {
            data.count -= 1;
            console.log(this == myBtn); // true - scope defaults to the dispatcher
            if (data.count == 0) {
                alert("clicked 3 times!");
                myBtn.off("click", listener);
                // alternately: evt.remove();
            }
        }

#### Parameters:

- `type` String

  The string type of the event.

- `listener` Function | Object

  An object with a handleEvent method, or a function that will be called when the event is dispatched.

- `[scope]` Object optional

  The scope to execute the listener in. Defaults to the dispatcher/currentTarget for function listeners, and to the listener itself for object listeners (ie. using handleEvent).

- `[once=false]` Boolean optional

  If true, the listener will remove itself after the first time it is triggered.

- `[data]` optional

  Arbitrary data that will be included as the second parameter when the listener is called.

- `[useCapture=false]` Boolean optional

  For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.

#### Returns:

Function:

Returns the anonymous function that was created and assigned as the listener. This is needed to remove the listener later using .removeEventListener.

### `removeAllChildren`

()

Inherited from Container: `removeAllChildren:288`

Removes all children from the display list.

#### Example

     container.removeAlLChildren();

### `removeAllEventListeners`

(

- `[type]`

)

Inherited from EventDispatcher: `removeAllEventListeners:258`

Removes all listeners for the specified type, or all listeners of all types.

#### Example

     // Remove all listeners
     displayObject.removeAllEventListeners();

     // Remove all click listeners
     displayObject.removeAllEventListeners("click");

#### Parameters:

- `[type]` String optional

  The string type of the event. If omitted, all listeners for all types will be removed.

### `removeChild`

(

- `child`

)
Boolean

Inherited from Container: `removeChild:228`

Removes the specified child from the display list. Note that it is faster to use removeChildAt() if the index is already known.

#### Example

     container.removeChild(child);

You can also remove multiple children:

     removeChild(child1, child2, ...);

Returns true if the child (or children) was removed, or false if it was not in the display list.

#### Parameters:

- `child` DisplayObject

  The child to remove.

#### Returns:

Boolean:

true if the child (or children) was removed, or false if it was not in the display list.

### `removeChildAt`

(

- `index`

)
Boolean

Inherited from Container: `removeChildAt:255`

Removes the child at the specified index from the display list, and sets its parent to null.

#### Example

     container.removeChildAt(2);

You can also remove multiple children:

     container.removeChild(2, 7, ...)

Returns true if the child (or children) was removed, or false if any index was out of range.

#### Parameters:

- `index` Number

  The index of the child to remove.

#### Returns:

Boolean:

true if the child (or children) was removed, or false if any index was out of range.

### `removeEventListener`

(

- `type`
- `listener`
- `[useCapture]`

)

Inherited from EventDispatcher: `removeEventListener:217`

Removes the specified event listener.

Important Note: that you must pass the exact function reference used when the event was added. If a proxy function, or function closure is used as the callback, the proxy/closure reference must be used - a new proxy or closure will not work.

#### Example

     displayObject.removeEventListener("click", handleClick);

#### Parameters:

- `type` String

  The string type of the event.

- `listener` Function | Object

  The listener function or object.

- `[useCapture]` Boolean optional

  For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.

### `set`

(

- `props`

)
DisplayObject

Inherited from DisplayObject: `set:1048`

Provides a chainable shortcut method for setting a number of properties on the instance.

#### Example

     var myGraphics = new createjs.Graphics().beginFill("#ff0000").drawCircle(0, 0, 25);
     var shape = stage.addChild(new Shape())
         .set({graphics:myGraphics, x:100, y:100, alpha:0.5});

#### Parameters:

- `props` Object

  A generic object containing properties to copy to the DisplayObject instance.

#### Returns:

DisplayObject:

Returns the instance the method is called on (useful for chaining calls.)

### `setBounds`

(

- `x`
- `y`
- `width`
- `height`

)

Inherited from DisplayObject: `setBounds:1151`

Allows you to manually specify the bounds of an object that either cannot calculate their own bounds (ex. Shape & Text) for future reference, or so the object can be included in Container bounds. Manually set bounds will always override calculated bounds.

The bounds should be specified in the object's local (untransformed) coordinates. For example, a Shape instance with a 25px radius circle centered at 0,0 would have bounds of (-25, -25, 50, 50).

#### Parameters:

- `x` Number

  The x origin of the bounds. Pass null to remove the manual bounds.

- `y` Number

  The y origin of the bounds.

- `width` Number

  The width of the bounds.

- `height` Number

  The height of the bounds.

### `setChildIndex`

(

- `child`
- `index`

)

Inherited from Container: `setChildIndex:410`

Changes the depth of the specified child. Fails silently if the child is not a child of this container, or the index is out of range.

#### Parameters:

- `child` DisplayObject
- `index` Number

### `setTransform`

(

- `[x=0]`
- `[y=0]`
- `[scaleX=1]`
- `[scaleY=1]`
- `[rotation=0]`
- `[skewX=0]`
- `[skewY=0]`
- `[regX=0]`
- `[regY=0]`

)
DisplayObject

Inherited from DisplayObject: `setTransform:951`

Shortcut method to quickly set the transform properties on the display object. All parameters are optional. Omitted parameters will have the default value set.

#### Example

     displayObject.setTransform(100, 100, 2, 2);

#### Parameters:

- `[x=0]` Number optional

  The horizontal translation (x position) in pixels

- `[y=0]` Number optional

  The vertical translation (y position) in pixels

- `[scaleX=1]` Number optional

  The horizontal scale, as a percentage of 1

- `[scaleY=1]` Number optional

  the vertical scale, as a percentage of 1

- `[rotation=0]` Number optional

  The rotation, in degrees

- `[skewX=0]` Number optional

  The horizontal skew factor

- `[skewY=0]` Number optional

  The vertical skew factor

- `[regX=0]` Number optional

  The horizontal registration point in pixels

- `[regY=0]` Number optional

  The vertical registration point in pixels

#### Returns:

DisplayObject:

Returns this instance. Useful for chaining commands.

### `sortChildren`

(

- `sortFunction`

)

Inherited from Container: `sortChildren:331`

Performs an array sort operation on the child list.

#### Example: Display children with a higher y in front.

     var sortFunction = function(obj1, obj2, options) {
         if (obj1.y > obj2.y) { return 1; }
         if (obj1.y < obj2.y) { return -1; }
         return 0;
     }
     container.sortChildren(sortFunction);

#### Parameters:

- `sortFunction` Function

  the function to use to sort the child list. See JavaScript's `Array.sort` documentation for details.

### `swapChildren`

(

- `child1`
- `child2`

)

Inherited from Container: `swapChildren:390`

Swaps the specified children's depth in the display list. Fails silently if either child is not a child of this Container.

#### Parameters:

- `child1` DisplayObject
- `child2` DisplayObject

### `swapChildrenAt`

(

- `index1`
- `index2`

)

Inherited from Container: `swapChildrenAt:375`

Swaps the children at the specified indexes. Fails silently if either index is out of range.

#### Parameters:

- `index1` Number
- `index2` Number

### `tick`

(

- `[params]`

)

Inherited from Stage: `tick:408`

Propagates a tick event through the display list. This is automatically called by update unless tickOnUpdate is set to false.

Any parameters passed to `tick()` will be included as an array in the "param" property of the event object dispatched to tick event handlers. Additionally, if the first parameter is a tick event object (or has equivalent properties), then the delta, time, runTime, and paused properties will be copied to the event object.

Some time-based features in EaselJS (for example Sprite/framerate require that a tick event object (or equivalent) be passed as the first parameter to tick(). For example:

        Ticker.on("tick", handleTick);
        function handleTick(evtObj) {
            // do some work here, then update the stage, passing through the tick event object as the first param
            // and some custom data as the second and third param:
            myStage.update(evtObj, "hello", 2014);
        }

        // ...
        myDisplayObject.on("tick", handleDisplayObjectTick);
        function handleDisplayObjectTick(evt) {
            console.log(evt.params[0]); // the original tick evtObj
            console.log(evt.delta, evt.paused); // ex. "17 false"
            console.log(evt.params[1], evt.params[2]); // "hello 2014"
        }

#### Parameters:

- `[params]` optional multiple

  Params to include when ticking descendants. The first param should usually be a tick event.

### `toDataURL`

(

- `backgroundColor`
- `mimeType`

)
String

Inherited from Stage: `toDataURL:476`

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` String

  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` String

  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:

String:

a Base64 encoded image.

### `toString`

() String

Inherited from EventDispatcher but overwritten in `toString:575`

Returns a string representation of this object.

#### Returns:

String:

a string representation of the instance.

### `uncache`

()

Inherited from DisplayObject: `uncache:837`

Clears the current cache. See cache for more information.

### `update`

(

- `[params]`

)

Inherited from Stage but overwritten in `update:450`

Each time the update method is called, the stage will tick all descendants (see: DisplayObject/tick) and then render the display list to the canvas using WebGL. If WebGL is not supported in the browser, it will default to a 2D context.

Any parameters passed to `update()` will be passed on to any tick event handlers.

Some time-based features in EaselJS (for example Sprite/framerate require that a tick event object (or equivalent) be passed as the first parameter to update(). For example:

     Ticker.addEventListener("tick", handleTick);
     function handleTick(evtObj) {
         // do some work here, then update the stage, passing through the event object:
         myStage.update(evtObj);
     }

#### Parameters:

- `[params]` optional multiple

  Params to include when ticking descendants. The first param should usually be a tick event.

### `updateCache`

(

- `compositeOperation`

)

Inherited from DisplayObject: `updateCache:784`

Redraws the display object to its cache. Calling updateCache without an active cache will throw an error. If compositeOperation is null the current cache will be cleared prior to drawing. Otherwise the display object will be drawn over the existing cache using the specified compositeOperation.

#### Example

Clear the current graphics of a cached shape, draw some new instructions, and then update the cache. The new line will be drawn on top of the old one.

     // Not shown: Creating the shape, and caching it.
     shapeInstance.clear();
     shapeInstance.setStrokeStyle(3).beginStroke("#ff0000").moveTo(100, 100).lineTo(200,200);
     shapeInstance.updateCache();

#### Parameters:

- `compositeOperation` String

  The compositeOperation to use, or null to clear the cache and redraw it. whatwg spec on compositing.

### `updateContext`

(

- `ctx`

)

Inherited from DisplayObject: `updateContext:709`

Applies this display object's transformation, alpha, globalCompositeOperation, clipping path (mask), and shadow to the specified context. This is typically called prior to draw.

#### Parameters:

- `ctx` CanvasRenderingContext2D

  The canvas 2D to update.

### `updateViewport`

(

- `width`
- `height`

)

Defined in `updateViewport:545`

Update the WebGL viewport. Note that this does NOT update the canvas element's width/height.

#### Parameters:

- `width` Number
- `height` Number

### `willTrigger`

(

- `type`

)
Boolean

Inherited from EventDispatcher: `willTrigger:340`

Indicates whether there is at least one listener for the specified event type on this object or any of its ancestors (parent, parent's parent, etc). A return value of true indicates that if a bubbling event of the specified type is dispatched from this object, it will trigger at least one listener.

This is similar to hasEventListener, but it searches the entire event flow for a listener, not just this object.

#### Parameters:

- `type` String

  The string type of the event.

#### Returns:

Boolean:

Returns `true` if there is at least one listener for the specified event.

## Properties

### `_antialias`

Boolean protected

Defined in `_antialias:184`

Specifies whether or not the browser's WebGL implementation should try to perform antialiasing.

Default: false

### `_bounds`

Rectangle protected

Inherited from DisplayObject: `_bounds:650`

Default: null

### `_cacheDataURL`

String protected

Inherited from DisplayObject: `_cacheDataURL:626`

Default: null

### `_cacheDataURLID`

Number protected

Inherited from DisplayObject: `_cacheDataURLID:618`

Default: 0

### `_cacheOffsetX`

Number protected

Inherited from DisplayObject: `_cacheOffsetX:594`

Default: 0

### `_cacheOffsetY`

Number protected

Inherited from DisplayObject: `_cacheOffsetY:602`

Default: 0

### `_cacheScale`

Number protected

Inherited from DisplayObject: `_cacheScale:610`

Default: 1

### `_captureListeners`

Object protected

Inherited from EventDispatcher: `_captureListeners:126`

### `_clearColor`

Object protected

Defined in `_clearColor:239`

The color to use when the WebGL canvas has been cleared.

Default: null

### `_currentBoxIndex`

Number protected

Defined in `_currentBoxIndex:329`

The current box index being defined for drawing.

Default: -1

### `_drawTexture`

WebGLTexture protected

Defined in `_drawTexture:338`

The current texture that will be used to draw into the GPU.

Default: null

### `_indices`

Uint16Array protected

Defined in `_indices:311`

The indices to the vertices defined in p._vertices.

Default: null

### `_indicesBuffer`

WebGLBuffer protected

Defined in `_indicesBuffer:320`

The buffer that contains all the indices data.

Default: null

### `_listeners`

Object protected

Inherited from EventDispatcher: `_listeners:119`

### `_matrix`

Matrix2D protected

Inherited from DisplayObject: `_matrix:634`

Default: null

### `_maxBoxesPerDraw`

Number protected

Defined in `_maxBoxesPerDraw:266`

The maximum number of boxes (sprites) that can be drawn in one draw call.

Default: null

### `_maxBoxesPointsPerDraw`

Number protected

Defined in `_maxBoxesPointsPerDraw:257`

The maximum total number of boxes points that can be defined per draw call.

Default: null

### `_maxIndicesPerDraw`

Number protected

Defined in `_maxIndicesPerDraw:275`

The maximum number of indices that can be drawn in one draw call.

Default: null

### `_maxTexturesPerDraw`

Number protected

Defined in `_maxTexturesPerDraw:248`

The maximum number of textures WebGL can work with per draw call.

Default: 1

### `_mouseOverIntervalID`

Number protected

Inherited from Stage: `_mouseOverIntervalID:331`

### `_nextStage`

Stage protected

Inherited from Stage: `_nextStage:338`

### `_pointerCount`

Object private

Inherited from Stage: `_pointerCount:315`

Number of active pointers.

### `_pointerData`

Object private

Inherited from Stage: `_pointerData:306`

Holds objects with data for each active pointer id. Each object has the following properties: x, y, event, target, overTarget, overX, overY, inBounds, posEvtObj (native event that last updated position)

### `_preserveDrawingBuffer`

Boolean protected

Defined in `_preserveDrawingBuffer:173`

Specifies whether or not the canvas is auto-cleared by WebGL. Spec discourages true. If true, the canvas is NOT auto-cleared by WebGL. Value is ignored if p._alphaEnabled is false. Useful if you want to use p.autoClear = false.

Default: false

### `_prevStage`

Stage protected

Inherited from Stage: `_prevStage:345`

### `_primaryPointerID`

Object private

Inherited from Stage: `_primaryPointerID:323`

The ID of the primary pointer.

### `_projectionMatrix`

Float32Array protected

Defined in `_projectionMatrix:211`

A 2D projection matrix used to convert WebGL's clipspace into normal pixels.

Default: null

### `_rectangle`

Rectangle protected

Inherited from DisplayObject: `_rectangle:642`

Default: null

### `_shaderProgram`

WebGLProgram protected

Defined in `_shaderProgram:284`

The shader program used to draw everything.

Default: null

### `_vertices`

Float32Array protected

Defined in `_vertices:293`

The vertices data for the current draw call.

Default: null

### `_verticesBuffer`

WebGLBuffer protected

Defined in `_verticesBuffer:302`

The buffer that contains all the vertices data.

Default: null

### `_viewportHeight`

Number protected

Defined in `_viewportHeight:202`

The height of the canvas element.

Default: 0

### `_viewportWidth`

Number protected

Defined in `_viewportWidth:193`

The width of the canvas element.

Default: 0

### `_webGLContext`

WebGLRenderingContext protected

Defined in `_webGLContext:220`

The current WebGL canvas context.

Default: null

### `_webGLErrorDetected`

Boolean protected

Defined in `_webGLErrorDetected:229`

Indicates whether or not an error has been detected when dealing with WebGL. If the is true, the behavior should be to use Canvas 2D rendering instead.

Default: false

### `alpha`

Number

Inherited from DisplayObject: `alpha:307`

The alpha (transparency) for this display object. 0 is fully transparent, 1 is fully opaque.

Default: 1

### `autoClear`

Boolean

Inherited from Stage: `autoClear:134`

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).

#### Example

     var stage = new createjs.Stage("canvasId");
     stage.autoClear = false;

Default: true

### `cacheCanvas`

HTMLCanvasElement | Object

Inherited from DisplayObject: `cacheCanvas:315`

If a cache is active, this returns the canvas that holds the cached version of this display object. See Cache for more information.

Default: null

### `cacheID`

Number

Inherited from DisplayObject: `cacheID:547`

Returns an ID number that uniquely identifies the current cache for this display object. This can be used to determine if the cache has changed since a previous check.

Default: 0

### `canvas`

HTMLCanvasElement | Object

Inherited from Stage: `canvas:150`

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).

When changing the canvas property you must disable the events on the old canvas, and enable events on the new canvas or mouse events will not work as expected. For example:

     myStage.enableDOMEvents(false);
     myStage.canvas = anotherCanvas;
     myStage.enableDOMEvents(true);

### `children`

Array

Inherited from Container: `children:61`

The array of children in the display list. You should usually use the child management methods such as addChild, removeChild, swapChildren, etc, rather than accessing this directly, but it is included for advanced uses.

Default: null

### `compositeOperation`

String

Inherited from DisplayObject: `compositeOperation:472`

The composite operation indicates how the pixels of this display object will be composited with the elements behind it. If `null`, this property is inherited from the parent container. For more information, read the whatwg spec on compositing.

Default: null

### `cursor`

String

Inherited from DisplayObject: `cursor:582`

A CSS cursor (ex. "pointer", "help", "text", etc) that will be displayed when the user hovers over this display object. You must enable mouseover events using the enableMouseOver method to use this property. Setting a non-null cursor on a Container will override the cursor set on its descendants.

Default: null

### `DisplayObject__tick`

Function private

Inherited from Container: `DisplayObject__tick:545`

### `DisplayObject_draw`

Function private

Inherited from Container: `DisplayObject_draw:126`

### `DisplayObject_getBounds`

Function protected

Inherited from Container: `DisplayObject_getBounds:491`

### `DisplayObject_initialize`

Function private

Inherited from Container but overwritten in `DisplayObject_initialize:353`

### `drawRect`

Rectangle

Inherited from Stage: `drawRect:184`

Specifies the area of the stage to affect when calling update. This can be use to selectively re-render only active regions of the canvas. If null, the whole canvas area is affected.

### `filters`

Array

Inherited from DisplayObject: `filters:537`

An array of Filter objects to apply to this display object. Filters are only applied / updated when Cache or UpdateCache is called on the display object, and only apply to the area that is cached.

Default: null

### `handleEvent`

Function

Inherited from Stage: `handleEvent:449`

Default event handler that calls the Stage update method when a tick event is received. This allows you to register a Stage instance as a event listener on Ticker directly, using:

     Ticker.addEventListener("tick", myStage");

Note that if you subscribe to ticks using this pattern, then the tick event object will be passed through to display object tick handlers, instead of `delta` and `paused` parameters.

### `hitArea`

DisplayObject

Inherited from DisplayObject but overwritten in `hitArea:251`

The hitArea property is not supported for Stage.

Default: null

### `id`

Number

Inherited from DisplayObject: `id:325`

Unique ID for this display object. Makes display objects easier for some uses.

Default: -1

### `INDICES_PER_BOX`

Number final static

Defined in `INDICES_PER_BOX:118`

The number of indices needed to define a box using triangles. 6 indices = 2 triangles = 1 box

### `isWebGL`

Boolean

Defined in `isWebGL:154`

Indicates whether WebGL is being used for rendering. For example, this would be false if WebGL is not supported in the browser.

### `mask`

Shape

Inherited from DisplayObject: `mask:556`

A Shape instance that defines a vector mask (clipping path) for this display object. The shape's transformation will be applied relative to the display object's parent coordinates (as if it were a child of the parent).

Default: null

### `MAX_BOXES_POINTS_INCREMENT`

Number final static

Defined in `MAX_BOXES_POINTS_INCREMENT:139`

The amount used to increment p._maxBoxesPointsPerDraw when the maximum has been reached. If the maximum size of element index WebGL allows for (SpriteStage.MAX_INDEX_SIZE) was used, the array size for p._vertices would equal 1280kb and p._indices 192kb. But since mobile phones with less memory need to be accounted for, the maximum size is somewhat arbitrarily divided by 4, reducing the array sizes to 320kb and 48kb respectively.

### `MAX_INDEX_SIZE`

Number final static

Defined in `MAX_INDEX_SIZE:129`

The maximum size WebGL allows for element index numbers: 16 bit unsigned integer

### `mouseChildren`

Boolean

Inherited from Container: `mouseChildren:72`

Indicates whether the children of this container are independently enabled for mouse/pointer interaction. If false, the children will be aggregated under the container - for example, a click on a child shape would trigger a click event on the container.

Default: true

### `mouseEnabled`

Boolean

Inherited from DisplayObject: `mouseEnabled:333`

Indicates whether to include this object when running mouse interactions. Setting this to `false` for children of a Container will cause events on the Container to not fire when that child is clicked. Setting this property to `false` does not prevent the getObjectsUnderPoint method from returning the child.

Note: In EaselJS 0.7.0, the mouseEnabled property will not work properly with nested Containers. Please check out the latest NEXT version in GitHub for an updated version with this issue resolved. The fix will be provided in the next release of EaselJS.

Default: true

### `mouseInBounds`

Boolean

Inherited from Stage: `mouseInBounds:225`

Indicates whether the mouse is currently within the bounds of the canvas.

Default: false

### `mouseMoveOutside`

Boolean

Inherited from Stage: `mouseMoveOutside:241`

If true, mouse move events will continue to be called when the mouse leaves the target canvas. See mouseInBounds, and MouseEvent x/y/rawX/rawY.

Default: false

### `mouseX`

Number

Inherited from Stage: `mouseX:166`

The current mouse X position on the canvas. If the mouse leaves the canvas, this will indicate the most recent position over the canvas, and mouseInBounds will be set to false.

### `mouseY`

Number

Inherited from Stage: `mouseY:175`

The current mouse Y position on the canvas. If the mouse leaves the canvas, this will indicate the most recent position over the canvas, and mouseInBounds will be set to false.

### `name`

String

Inherited from DisplayObject: `name:358`

An optional name for this display object. Included in toString . Useful for debugging.

Default: null

### `nextStage`

Stage

Inherited from Stage: `nextStage:259`

Specifies a target stage that will have mouse / touch interactions relayed to it after this stage handles them. This can be useful in cases where you have multiple layered canvases and want user interactions events to pass through. For example, this would relay mouse events from topStage to bottomStage:

     topStage.nextStage = bottomStage;

To disable relaying, set nextStage to null.

MouseOver, MouseOut, RollOver, and RollOut interactions are also passed through using the mouse over settings of the top-most stage, but are only processed if the target stage has mouse over interactions enabled. Considerations when using roll over in relay targets:

1. The top-most (first) stage must have mouse over interactions enabled (via enableMouseOver)

2. All stages that wish to participate in mouse over interaction must enable them via enableMouseOver

3. All relay targets will share the frequency value of the top-most stage

To illustrate, in this example the targetStage would process mouse over interactions at 10hz (despite passing 30 as it's desired frequency): topStage.nextStage = targetStage; topStage.enableMouseOver(10); targetStage.enableMouseOver(30);

If the target stage's canvas is completely covered by this stage's canvas, you may also want to disable its DOM events using:

    targetStage.enableDOMEvents(false);

### `NUM_VERTEX_PROPERTIES`

Number final static

Defined in `NUM_VERTEX_PROPERTIES:87`

The number of properties defined per vertex in p._verticesBuffer. x, y, textureU, textureV, alpha

### `NUM_VERTEX_PROPERTIES_PER_BOX`

Number final static

Defined in `NUM_VERTEX_PROPERTIES_PER_BOX:108`

The number of vertex properties per box.

### `onClick`

Function deprecated

Inherited from DisplayObject: `onClick:501`

Deprecated: Use addEventListener and the "click" event.

REMOVED. Use addEventListener and the click event.

### `onDoubleClick`

Function deprecated

Inherited from DisplayObject: `onDoubleClick:508`

Deprecated: Use addEventListener and the "dblclick" event.

REMOVED. Use addEventListener and the dblclick event.

### `onMouseDown`

Function deprecated

Inherited from Stage: `onMouseDown:207`

Deprecated: Use addEventListener and the "stagemousedown" event.

REMOVED. Use addEventListener and the stagemousedown event.

### `onMouseMove`

Function deprecated

Inherited from Stage: `onMouseMove:193`

Deprecated: Use addEventListener and the "stagemousemove" event.

REMOVED. Use addEventListener and the "stagemousemove event.

### `onMouseOut`

Function deprecated

Inherited from DisplayObject: `onMouseOut:522`

Deprecated: Use addEventListener and the "mouseout" event.

REMOVED. Use addEventListener and the mouseout event.

### `onMouseOver`

Function deprecated

Inherited from DisplayObject: `onMouseOver:515`

Deprecated: Use addEventListener and the "mouseover" event.

REMOVED. Use addEventListener and the mouseover event.

### `onMouseUp`

Function deprecated

Inherited from Stage: `onMouseUp:200`

Deprecated: Use addEventListener and the "stagemouseup" event.

REMOVED. Use addEventListener and the stagemouseup event.

### `onPress`

Function deprecated

Inherited from DisplayObject: `onPress:494`

Deprecated: Use addEventListener and the "mousedown" event.

REMOVED. Use addEventListener and the mousedown event.

### `onTick`

Function deprecated

Inherited from DisplayObject: `onTick:529`

Deprecated: Use addEventListener and the "tick" event.

REMOVED. Use addEventListener and the tick event.

### `parent`

Container final

Inherited from DisplayObject: `parent:367`

A reference to the Container or Stage object that contains this display object, or null if it has not been added to one.

Default: null

### `POINTS_PER_BOX`

Number final static

Defined in `POINTS_PER_BOX:98`

The number of points in a box...obviously :)

### `regX`

Number

Inherited from DisplayObject: `regX:379`

The left offset for this display object's registration point. For example, to make a 100x100px Bitmap rotate around its center, you would set regX and regY to 50.

Default: 0

### `regY`

Number

Inherited from DisplayObject: `regY:388`

The y offset for this display object's registration point. For example, to make a 100x100px Bitmap rotate around its center, you would set regX and regY to 50.

Default: 0

### `rotation`

Number

Inherited from DisplayObject: `rotation:397`

The rotation in degrees for this display object.

Default: 0

### `scaleX`

Number

Inherited from DisplayObject: `scaleX:405`

The factor to stretch this display object horizontally. For example, setting scaleX to 2 will stretch the display object to twice its nominal width. To horizontally flip an object, set the scale to a negative number.

Default: 1

### `scaleY`

Number

Inherited from DisplayObject: `scaleY:414`

The factor to stretch this display object vertically. For example, setting scaleY to 0.5 will stretch the display object to half its nominal height. To vertically flip an object, set the scale to a negative number.

Default: 1

### `shadow`

Shadow

Inherited from DisplayObject: `shadow:439`

A shadow object that defines the shadow to render on this display object. Set to `null` to remove a shadow. If null, this property is inherited from the parent container.

Default: null

### `skewX`

Number

Inherited from DisplayObject: `skewX:423`

The factor to skew this display object horizontally.

Default: 0

### `skewY`

Number

Inherited from DisplayObject: `skewY:431`

The factor to skew this display object vertically.

Default: 0

### `snapToPixel`

Boolean

Inherited from DisplayObject: `snapToPixel:483`

Indicates whether the display object should be drawn to a whole pixel when Stage/snapToPixelEnabled is true. To enable/disable snapping on whole categories of display objects, set this value on the prototype (Ex. Text.prototype.snapToPixel = true).

Default: true

### `snapToPixelEnabled`

Boolean

Inherited from Stage: `snapToPixelEnabled:215`

Indicates whether display objects should be rendered on whole pixels. You can set the DisplayObject/snapToPixel property of display objects to false to enable/disable this behaviour on a per instance basis.

Default: false

### `Stage_draw`

Function private

Defined in `Stage_draw:511`

### `Stage_initialize`

Function private

Defined in `Stage_initialize:349`

### `tickChildren`

Boolean

Inherited from Container: `tickChildren:82`

If false, the tick will not be propagated to children of this Container. This can provide some performance benefits. In addition to preventing the "tick" event from being dispatched, it will also prevent tick related updates on some display objects (ex. Sprite & MovieClip frame advancing, DOMElement visibility handling).

Default: true

### `tickEnabled`

Boolean

Inherited from DisplayObject: `tickEnabled:348`

If false, the tick will not run on this display object (or its children). This can provide some performance benefits. In addition to preventing the "tick" event from being dispatched, it will also prevent tick related updates on some display objects (ex. Sprite & MovieClip frame advancing, DOMElement visibility handling).

Default: true

### `tickOnUpdate`

Boolean

Inherited from Stage: `tickOnUpdate:233`

If true, tick callbacks will be called on all display objects on the stage prior to rendering to the canvas.

Default: true

### `visible`

Boolean

Inherited from DisplayObject: `visible:448`

Indicates whether this display object should be rendered to the canvas and included when running the Stage Stage/getObjectsUnderPoint method.

Default: true

### `x`

Number

Inherited from DisplayObject: `x:457`

The x (horizontal) position of the display object, relative to its parent.

Default: 0

### `y`

Number

Inherited from DisplayObject: `y:465`

Default: 0

## Events

### `click`

Inherited from DisplayObject: `click:206`

Available since 0.6.0

Dispatched when the user presses their left mouse button and then releases it while over the display object. See the MouseEvent class for a listing of event properties.

### `dblclick`

Inherited from DisplayObject: `dblclick:213`

Available since 0.6.0

Dispatched when the user double clicks their left mouse button over this display object. See the MouseEvent class for a listing of event properties.

### `drawend`

Inherited from Stage: `drawend:127`

Available since 0.7.0

Dispatched each update immediately after the display list is drawn to the canvas and the canvas context is restored.

### `drawstart`

Inherited from Stage: `drawstart:120`

Available since 0.7.0

Dispatched each update immediately before the canvas is cleared and the display list is drawn to it. You can call preventDefault on the event object to cancel the draw.

### `mousedown`

Inherited from DisplayObject: `mousedown:199`

Available since 0.6.0

Dispatched when the user presses their left mouse button over the display object. See the MouseEvent class for a listing of event properties.

### `mouseenter`

Inherited from Stage: `mouseenter:98`

Available since 0.7.0

Dispatched when the mouse moves into the canvas area (mouseInBounds == false) from outside it (mouseInBounds == true). This is currently only dispatched for mouse input (not touch). See the MouseEvent class for a listing of event properties.

### `mouseleave`

Inherited from Stage: `mouseleave:90`

Available since 0.7.0

Dispatched when the mouse moves from within the canvas area (mouseInBounds == true) to outside it (mouseInBounds == false). This is currently only dispatched for mouse input (not touch). See the MouseEvent class for a listing of event properties.

### `mouseout`

Inherited from DisplayObject: `mouseout:228`

Available since 0.6.0

Dispatched when the user's mouse leaves this display object. This event must be enabled using enableMouseOver. See also rollout. See the MouseEvent class for a listing of event properties.

### `mouseover`

Inherited from DisplayObject: `mouseover:220`

Available since 0.6.0

Dispatched when the user's mouse enters this display object. This event must be enabled using enableMouseOver. See also rollover. See the MouseEvent class for a listing of event properties.

### `pressmove`

Inherited from DisplayObject: `pressmove:276`

Available since 0.7.0

After a mousedown occurs on a display object, a pressmove event will be generated on that object whenever the mouse moves until the mouse press is released. This can be useful for dragging and similar operations.

### `pressup`

Inherited from DisplayObject: `pressup:284`

Available since 0.7.0

After a mousedown occurs on a display object, a pressup event will be generated on that object when that mouse press is released. This can be useful for dragging and similar operations.

### `rollout`

Inherited from DisplayObject: `rollout:256`

Available since 0.7.0

This event is similar to mouseout, with the following differences: it does not bubble, and it considers Container instances as an aggregate of their content.

For example, myContainer contains two overlapping children: shapeA and shapeB. The user moves their mouse over shapeA, then directly on to shapeB, then off both. With a listener for Mouseout:event on myContainer, two events would be received, each targeting a child element:

1. when the mouse leaves shapeA (target=shapeA)

2. when the mouse leaves shapeB (target=shapeB)

However, with a listener for "rollout" instead, only a single event is received when the mouse leaves the aggregate myContainer content (target=myContainer).

This event must be enabled using enableMouseOver. See the MouseEvent class for a listing of event properties.

### `rollover`

Inherited from DisplayObject: `rollover:236`

Available since 0.7.0

This event is similar to mouseover, with the following differences: it does not bubble, and it considers Container instances as an aggregate of their content.

For example, myContainer contains two overlapping children: shapeA and shapeB. The user moves their mouse over shapeA and then directly on to shapeB. With a listener for Mouseover:event on myContainer, two events would be received, each targeting a child element:

1. when the mouse enters shapeA (target=shapeA)

2. when the mouse enters shapeB (target=shapeB)

However, with a listener for "rollover" instead, only a single event is received when the mouse first enters the aggregate myContainer content (target=myContainer).

This event must be enabled using enableMouseOver. See the MouseEvent class for a listing of event properties.

### `stagemousedown`

Inherited from Stage: `stagemousedown:76`

Available since 0.6.0

Dispatched when the user presses their left mouse button on the canvas. See the MouseEvent class for a listing of event properties.

### `stagemousemove`

Inherited from Stage: `stagemousemove:69`

Available since 0.6.0

Dispatched when the user moves the mouse over the canvas. See the MouseEvent class for a listing of event properties.

### `stagemouseup`

Inherited from Stage: `stagemouseup:83`

Available since 0.6.0

Dispatched when the user the user releases the mouse button anywhere that the page can detect it (this varies slightly between browsers). See the MouseEvent class for a listing of event properties.

### `tick`

Inherited from DisplayObject: `tick:292`

Available since 0.6.0

Dispatched on each display object on a stage whenever the stage updates. This occurs immediately before the rendering (draw) pass. When update is called, first all display objects on the stage dispatch the tick event, then all of the display objects are drawn to stage. Children will have their Tick:event event dispatched in order of their depth prior to the event being dispatched on their parent.

#### Event Payload:

- `target` Object

  The object that dispatched the event.

- `type` String

  The event type.

- `params` Array

  An array containing any arguments that were passed to the Stage.update() method. For example if you called stage.update("hello"), then the params would be ["hello"].

### `tickend`

Inherited from Stage: `tickend:113`

Available since 0.7.0

Dispatched each update immediately after the tick event is propagated through the display list. Does not fire if tickOnUpdate is false. Precedes the "drawstart" event.

### `tickstart`

Inherited from Stage: `tickstart:106`

Available since 0.7.0

Dispatched each update immediately before the tick event is propagated through the display list. You can call preventDefault on the event object to cancel propagating the tick event.