Class Index | File Index

Classes


Class createjs.DisplayObject


Extends .

Defined in: display_object.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
A base class for all drawable objects.
Field Summary
Field Attributes Field Name and Description
 
A dirty flag, i.e.
<static>  
createjs.DisplayObject.DIRTY_ALL
A flag representing that this object needs to update all its properties.
<static>  
createjs.DisplayObject.DIRTY_BOX
A flag representing that this object needs to update its bounding box.
<static>  
createjs.DisplayObject.DIRTY_MASK
A flag representing that this object needs to update its mask.
<static>  
createjs.DisplayObject.DIRTY_PROPERTIES
A flag representing that this object needs to update its attributes.
<static>  
createjs.DisplayObject.DIRTY_SHAPE
A flag representing that this object needs to update its shape.
<static>  
createjs.DisplayObject.DIRTY_TRANSFORM
A flag representing that this object needs to update its affine transformation.
 
id
The Unique ID assigned to this display object.
 
Whether this object is a 'createjs.Stage' object.
 
A rectangle automatically generated by Flash.
Method Summary
Method Attributes Method Name and Description
 
addChild(var_args)
Adds a child (or children) to the top of this display object.
 
addChildAt(var_args)
Adds a child (or children) to this display object at the specified index.
 
addGraphics(graphics)
 
beginPaintObject(renderer)
 
cache(x, y, width, height, opt_scale)
Draws this display object into a cache element.
 
Destroys all properties of this object.
 
draw(context, ignoreCache)
Draws this display object into the specified context.
 
Retrieves the alpha value.
 
Returns the alpha-map filter attached to this object.
 
Returns the bounding box of this object.
 
Returns a rectangle representing this object's bounds in its local coordinate system, i.e.
 
Retrieves the height of this object.
 
Retrieves the width of this object.
 
Returns a data URL of the cache element.
 
 
Returns the color filter attached to this object.
 
Retrieves the composite operation.
 
Retrieves the ID of the composite operation.
 
Returns the current position of the tweens attached to this object.
 
Returns the dirty state of this object.
 
Retrieves the list of filters.
 
Returns the inverse-affine transformation used for transforming a point in the global coordination to a point in the coordination of this object.
 
Retrieves the masking path.
 
 
Returns the display object which owns this object only if this object is a mask.
 
Retrieves the parent of this object.
 
 
Retrieves the horizontal registration point.
 
Retrieves the vertical registration point.
 
 
Retrieves the rotation.
 
Retrieves the horizontal scale.
 
Retrieves the vertical scale.
 
 
Retrieves the shadow properties.
 
Retrieves the horizontal skew.
 
Retrieves the vertical skew.
 
Returns the createjs.Stage object to which that this display object belongs to, or null if it is detached.
 
Returns a set of parameters used for rendering this object.
 
Returns a rectangle representing this object's bounds in the coordinate system of its parent.
 
Retrieves the visibility.
 
getX()
Retrieves the horizontal position.
 
getY()
Retrieves the vertical position.
 
Transforms the specified x and y position from the global coordinate to the one of this object.
 
Called when this display object is attached to another display object as its child.
 
Called when this display object is detached from another display object.
 
 
hitTest(x, y)
Tests whether this display object intersects the specified local point.
 
hitTestObject(point, types, bubble)
Returns an object under the specified point.
 
hitTestObjects(point, list, types, bubble)
Returns all objects under the specified point.
 
 
Returns whether this object is playing its tweens or its sprite sheet.
 
Returns whether this display object is visible.
 
layout(renderer, parent, dirty, time, draw)
Updates the layout of this object.
 
Transforms the specified x and y position from the coordinate of this object to the global coordinate.
 
localToLocal(x, y, target)
Transforms the specified x and y position from the coordinate of this object to the one of the specified target object.
 
paintObject(renderer)
 
playTweens(time)
 
 
removeAllChildren(opt_destroy)
Removes all children from this display object.
 
removeChild(var_args)
Removes the specified child (or children) from this display object.
 
removeChildAt(var_args)
Removes the child (or children) at the specified index from this display object.
 
 
set(properties)
Sets properties of this DisplayObject object.
 
setAlpha(alpha)
Sets the alpha value.
 
setBoundingBox(minX, minY, maxX, maxY)
Sets the bounding box of this object.
 
setBounds(x, y, width, height)
Allows you to manually specify the bounds of an object.
 
Sets the composite operation.
 
Sets the current position of the tweens attached to this object.
 
setDirty(dirty)
Sets the dirty state of this object.
 
setFilters(filters)
Sets the list of filters.
 
setIsPaused(paused)
Sets the current playing status of its tweens or its sprite sheet.
 
setMask(mask)
Sets the masking path.
 
setOff(off)
 
setParent(parent)
Sets the horizontal position.
 
 
setRegX(regX)
Sets the horizontal registration point.
 
setRegY(regY)
Sets the vertical registration point.
 
setRotation(rotation)
Sets the rotation.
 
setScaleX(scaleX)
Sets the horizontal scale.
 
setScaleY(scaleY)
Sets the vertical scale.
 
setShadow(shadow)
Sets the shadow properties.
 
setSkewX(skewX)
Sets the horizontal skew.
 
setSkewY(skewY)
Sets the vertical skew.
 
setTransform(x, y, scaleX, scaleY, rotation, skewX, skewY, regX, regY)
Sets the transform properties on this display object.
 
setTweenPosition(position)
 
setTweenProperties(loop, position, single)
 
setVisible(visible)
Sets the visibility.
 
setX(x)
Sets the horizontal position.
 
setY(y)
Sets the vertical position.
 
stopTweens(time)
 
synchronize(target, synchronize)
 
Clears the cache element.
 
 
updateCache(compositeOperation)
Redraws this display object to a cache element.
 
updateContext(context)
Applies this display object's transformation, alpha, composite operation, clipping path (mask), and shadow to the specified context.
 
updateLayout(parent, dirty)
Updates the rendering state of this object.
 
Class Detail
createjs.DisplayObject()
A base class for all drawable objects. This class consists of five functionalities listed below: 1. Implementing external methods used by games; 2. Implementing getters and setters to monitor the properties changed by games; 3. Implementing an interface used for rendering an object; 4. Implementing an interface used by a tween to change the properties of this object, and; 5. Updating tweens attached to this object. A display object updates its tweens when its target is being rendered not only because it can monitor property changes to it but also because it can update a tween only once/frame.)
Field Detail
dirty
A dirty flag, i.e. a flag representing variables that should be re-calculated before a createjs.Renderer object renders this object.

<static> createjs.DisplayObject.DIRTY_ALL
A flag representing that this object needs to update all its properties.

<static> createjs.DisplayObject.DIRTY_BOX
A flag representing that this object needs to update its bounding box.

<static> createjs.DisplayObject.DIRTY_MASK
A flag representing that this object needs to update its mask.

<static> createjs.DisplayObject.DIRTY_PROPERTIES
A flag representing that this object needs to update its attributes.

<static> createjs.DisplayObject.DIRTY_SHAPE
A flag representing that this object needs to update its shape.

<static> createjs.DisplayObject.DIRTY_TRANSFORM
A flag representing that this object needs to update its affine transformation.

id
The Unique ID assigned to this display object.

isStage
Whether this object is a 'createjs.Stage' object.

nominalBounds
A rectangle automatically generated by Flash. Even though this library does not use this rectangle, we add its placeholder to prevent Flash from extending the DisplayObject object.
Method Detail
{createjs.DisplayObject} addChild(var_args)
Adds a child (or children) to the top of this display object.
Parameters:
{...createjs.DisplayObject} var_args
Returns:
{createjs.DisplayObject}

{createjs.DisplayObject} addChildAt(var_args)
Adds a child (or children) to this display object at the specified index.
Parameters:
{...(createjs.DisplayObject|number)} var_args
Returns:
{createjs.DisplayObject}

addGraphics(graphics)
Parameters:
graphics

beginPaintObject(renderer)
Parameters:
renderer

cache(x, y, width, height, opt_scale)
Draws this display object into a cache element. (This method is deprecated because derived objects have caches optimized for them.)
Parameters:
{number} x
{number} y
{number} width
{number} height
{number=} opt_scale

destroy()
Destroys all properties of this object.

{boolean} draw(context, ignoreCache)
Draws this display object into the specified context. (This method is deprecated because it does not work with WebGL.)
Parameters:
{CanvasRenderingContext2D} context
{boolean} ignoreCache
Returns:
{boolean}

{number} getAlpha()
Retrieves the alpha value.
Returns:
{number}

{createjs.AlphaMapFilter} getAlphaMapFilter()
Returns the alpha-map filter attached to this object.
Returns:
{createjs.AlphaMapFilter}

{createjs.BoundingBox} getBoundingBox()
Returns the bounding box of this object.
Returns:
{createjs.BoundingBox}

{createjs.Rectangle} getBounds()
Returns a rectangle representing this object's bounds in its local coordinate system, i.e. without affine transformation. This method converts the bounding box calculated in rendering this object to a createjs.Rectangle object and returns it. (This method returns an empty rectangle when it has never been rendered.)
Returns:
{createjs.Rectangle}

{number} getBoxHeight()
Retrieves the height of this object.
Returns:
{number}

{number} getBoxWidth()
Retrieves the width of this object.
Returns:
{number}

{string} getCacheDataURL()
Returns a data URL of the cache element.
Returns:
{string}

getClip()

{Array.} getColorMatrix()
Returns the color filter attached to this object.
Returns:
{Array.}

{string} getComposition()
Retrieves the composite operation.
Returns:
{string}

{number} getCompositionId()
Retrieves the ID of the composite operation.
Returns:
{number}

{number} getCurrentFrame()
Returns the current position of the tweens attached to this object.
Returns:
{number}

{number} getDirty()
Returns the dirty state of this object.
Returns:
{number}

{Array.} getFilters()
Retrieves the list of filters.
Returns:
{Array.}

{createjs.Transform} getInverse()
Returns the inverse-affine transformation used for transforming a point in the global coordination to a point in the coordination of this object.
Returns:
{createjs.Transform}

{createjs.DisplayObject} getMask()
Retrieves the masking path.
Returns:
{createjs.DisplayObject}

getOff()

{Array.} getOwners()
Returns the display object which owns this object only if this object is a mask.
Returns:
{Array.}

{createjs.DisplayObject} getParent()
Retrieves the parent of this object.
Returns:
{createjs.DisplayObject}

getPlayMode()

{number} getRegX()
Retrieves the horizontal registration point.
Returns:
{number}

{number} getRegY()
Retrieves the vertical registration point.
Returns:
{number}

getRenderBox()

{number} getRotation()
Retrieves the rotation.
Returns:
{number}

{number} getScaleX()
Retrieves the horizontal scale.
Returns:
{number}

{number} getScaleY()
Retrieves the vertical scale.
Returns:
{number}

getSetters()

{createjs.Shadow} getShadow()
Retrieves the shadow properties.
Returns:
{createjs.Shadow}

{number} getSkewX()
Retrieves the horizontal skew.
Returns:
{number}

{number} getSkewY()
Retrieves the vertical skew.
Returns:
{number}

{createjs.DisplayObject} getStage()
Returns the createjs.Stage object to which that this display object belongs to, or null if it is detached.
Returns:
{createjs.DisplayObject}

{createjs.DisplayObject.RenderState} getState()
Returns a set of parameters used for rendering this object.
Returns:
{createjs.DisplayObject.RenderState}

{createjs.Rectangle} getTransformedBounds()
Returns a rectangle representing this object's bounds in the coordinate system of its parent.
Returns:
{createjs.Rectangle}

{boolean} getVisible()
Retrieves the visibility.
Returns:
{boolean}

{number} getX()
Retrieves the horizontal position.
Returns:
{number}

{number} getY()
Retrieves the vertical position.
Returns:
{number}

{createjs.Point} globalToLocal(x, y)
Transforms the specified x and y position from the global coordinate to the one of this object.
Parameters:
{number} x
{number} y
Returns:
{createjs.Point}

handleAttach(flag)
Called when this display object is attached to another display object as its child.
Parameters:
{number} flag

handleDetach()
Called when this display object is detached from another display object.

hasTweens()

{boolean} hitTest(x, y)
Tests whether this display object intersects the specified local point.
Parameters:
{number} x
{number} y
Returns:
{boolean}

{createjs.DisplayObject} hitTestObject(point, types, bubble)
Returns an object under the specified point. (This point is one in the global coordinate.)
Parameters:
{createjs.Point} point
{number} types
{number} bubble
Returns:
{createjs.DisplayObject}

hitTestObjects(point, list, types, bubble)
Returns all objects under the specified point.
Parameters:
{createjs.Point} point
{Array.} list
{number} types
{number} bubble

isDirtyObject(box)
Parameters:
box

{boolean} isPaused()
Returns whether this object is playing its tweens or its sprite sheet.
Returns:
{boolean}

{boolean} isVisible()
Returns whether this display object is visible.
Returns:
{boolean}

{number} layout(renderer, parent, dirty, time, draw)
Updates the layout of this object.
Parameters:
{createjs.Renderer} renderer
{createjs.DisplayObject} parent
{number} dirty
{number} time
{number} draw
Returns:
{number}

{createjs.Point} localToGlobal(x, y)
Transforms the specified x and y position from the coordinate of this object to the global coordinate.
Parameters:
{number} x
{number} y
Returns:
{createjs.Point}

{createjs.Point} localToLocal(x, y, target)
Transforms the specified x and y position from the coordinate of this object to the one of the specified target object.
Parameters:
{number} x
{number} y
{createjs.DisplayObject} target
Returns:
{createjs.Point}

paintObject(renderer)
Parameters:
renderer

playTweens(time)
Parameters:
time

registerTween(tween)
Parameters:
tween

removeAllChildren(opt_destroy)
Removes all children from this display object.
Parameters:
{boolean=} opt_destroy

{boolean} removeChild(var_args)
Removes the specified child (or children) from this display object.
Parameters:
{...createjs.DisplayObject} var_args
Returns:
{boolean}

{boolean} removeChildAt(var_args)
Removes the child (or children) at the specified index from this display object.
Parameters:
{...number} var_args
Returns:
{boolean}

resetTweens()

{createjs.DisplayObject} set(properties)
Sets properties of this DisplayObject object.
Parameters:
{Object} properties
Returns:
{createjs.DisplayObject}

setAlpha(alpha)
Sets the alpha value.
Parameters:
{number} alpha

setBoundingBox(minX, minY, maxX, maxY)
Sets the bounding box of this object.
Parameters:
{number} minX
{number} minY
{number} maxX
{number} maxY

setBounds(x, y, width, height)
Allows you to manually specify the bounds of an object. (This method is deprecated because each display object calculates its bounds correctly.)
Parameters:
{number} x
{number} y
{number} width
{number} height

setComposition(value)
Sets the composite operation.
Parameters:
{string} value

setCurrentFrame(frame)
Sets the current position of the tweens attached to this object.
Parameters:
{number} frame

setDirty(dirty)
Sets the dirty state of this object.
Parameters:
{number} dirty

setFilters(filters)
Sets the list of filters.
Parameters:
{Array.} filters

setIsPaused(paused)
Sets the current playing status of its tweens or its sprite sheet.
Parameters:
{boolean} paused

setMask(mask)
Sets the masking path.
Parameters:
{createjs.DisplayObject} mask

setOff(off)
Parameters:
off

setParent(parent)
Sets the horizontal position.
Parameters:
{createjs.DisplayObject} parent

setPlayMode(mode)
Parameters:
mode

setRegX(regX)
Sets the horizontal registration point.
Parameters:
{number} regX

setRegY(regY)
Sets the vertical registration point.
Parameters:
{number} regY

setRotation(rotation)
Sets the rotation.
Parameters:
{number} rotation

setScaleX(scaleX)
Sets the horizontal scale.
Parameters:
{number} scaleX

setScaleY(scaleY)
Sets the vertical scale.
Parameters:
{number} scaleY

setShadow(shadow)
Sets the shadow properties.
Parameters:
{createjs.Shadow} shadow

setSkewX(skewX)
Sets the horizontal skew.
Parameters:
{number} skewX

setSkewY(skewY)
Sets the vertical skew.
Parameters:
{number} skewY

{createjs.DisplayObject} setTransform(x, y, scaleX, scaleY, rotation, skewX, skewY, regX, regY)
Sets the transform properties on this display object.
Parameters:
{number} x
{number} y
{number} scaleX
{number} scaleY
{number} rotation
{number} skewX
{number} skewY
{number} regX
{number} regY
Returns:
{createjs.DisplayObject}

setTweenPosition(position)
Parameters:
position

setTweenProperties(loop, position, single)
Parameters:
loop
position
single

setVisible(visible)
Sets the visibility.
Parameters:
{boolean} visible

setX(x)
Sets the horizontal position.
Parameters:
{number} x

setY(y)
Sets the vertical position.
Parameters:
{number} y

stopTweens(time)
Parameters:
time

synchronize(target, synchronize)
Parameters:
target
synchronize

uncache()
Clears the cache element.

unregisterTween(tween)
Parameters:
tween

updateCache(compositeOperation)
Redraws this display object to a cache element.
Parameters:
{string} compositeOperation

updateContext(context)
Applies this display object's transformation, alpha, composite operation, clipping path (mask), and shadow to the specified context. (This method is deprecated because it does not work with WebGL.)
Parameters:
{CanvasRenderingContext2D} context

updateLayout(parent, dirty)
Updates the rendering state of this object.
Parameters:
{createjs.DisplayObject} parent
{number} dirty

updateTweens(time)
Parameters:
time

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Oct 04 2016 17:11:27 GMT+0900 (JST)