Package | starling.display |
Class | public class Canvas |
Inheritance | Canvas DisplayObjectContainer DisplayObject EventDispatcher Object |
Method | Defined By | ||
---|---|---|---|
Canvas() Creates a new (empty) Canvas. | Canvas | ||
Adds a child to the container. | DisplayObjectContainer | ||
Adds a child to the container at a certain index. | DisplayObjectContainer | ||
addEventListener(type:String, listener:Function):void [override] Registers an event listener at a certain object. | DisplayObject | ||
alignPivot(horizontalAlign:String = center, verticalAlign:String = center):void Moves the pivot point to a certain position within the local coordinate system
of the object. | DisplayObject | ||
beginFill(color:uint = 0xffffff, alpha:Number = 1.0):void Specifies a simple one-color fill that subsequent calls to drawing methods
(such as drawCircle()) will use. | Canvas | ||
broadcastEvent(event:Event):void Dispatches an event on all children (recursively). | DisplayObjectContainer | ||
broadcastEventWith(eventType:String, data:Object = null):void Dispatches an event with the given parameters on all children (recursively). | DisplayObjectContainer | ||
clear():void Removes all existing vertices. | Canvas | ||
contains(child:DisplayObject):Boolean Determines if a certain object is a child of the container (recursively). | DisplayObjectContainer | ||
dispatchEvent(event:Event):void Dispatches an event to all objects that have registered listeners for its type. | EventDispatcher | ||
dispatchEventWith(type:String, bubbles:Boolean = false, data:Object = null):void Dispatches an event with the given parameters to all objects that have registered
listeners for the given type. | EventDispatcher | ||
dispose():void [override] Disposes the resources of all children. | Canvas | ||
drawCircle(x:Number, y:Number, radius:Number, numSides:int = -1):void Draws a circle. | Canvas | ||
drawEllipse(x:Number, y:Number, width:Number, height:Number, numSides:int = -1):void Draws an ellipse. | Canvas | ||
drawPolygon(polygon:Polygon):void Draws an arbitrary polygon. | Canvas | ||
drawRectangle(x:Number, y:Number, width:Number, height:Number):void Draws a rectangle. | Canvas | ||
drawToBitmapData(out:BitmapData = null, color:uint = 0x0, alpha:Number = 0.0):BitmapData Draws the object into a BitmapData object. | DisplayObject | ||
endFill():void Resets the color to 'white' and alpha to '1'. | Canvas | ||
getBounds(targetSpace:DisplayObject, out:Rectangle = null):Rectangle [override] Returns a rectangle that completely encloses the object as it appears in another
coordinate system. | DisplayObjectContainer | ||
getChildAt(index:int):DisplayObject Returns a child object at a certain index. | DisplayObjectContainer | ||
getChildByName(name:String):DisplayObject Returns a child object with a certain name (non-recursively). | DisplayObjectContainer | ||
getChildIndex(child:DisplayObject):int Returns the index of a child within the container, or "-1" if it is not found. | DisplayObjectContainer | ||
getTransformationMatrix(targetSpace:DisplayObject, out:Matrix = null):Matrix Creates a matrix that represents the transformation from the local coordinate system
to another. | DisplayObject | ||
getTransformationMatrix3D(targetSpace:DisplayObject, out:Matrix3D = null):Matrix3D Creates a matrix that represents the transformation from the local coordinate system
to another. | DisplayObject | ||
globalToLocal(globalPoint:Point, out:Point = null):Point Transforms a point from global (stage) coordinates to the local coordinate system. | DisplayObject | ||
globalToLocal3D(globalPoint:Point, out:Vector3D = null):Vector3D Transforms a point from global (stage) coordinates to the 3D local coordinate system. | DisplayObject | ||
hasEventListener(type:String, listener:Function = null):Boolean If called with one argument, figures out if there are any listeners registered for
the given event type. | EventDispatcher | ||
hitTest(localPoint:Point):DisplayObject [override] Returns the object that is found topmost beneath a point in local coordinates, or nil
if the test fails. | Canvas | ||
hitTestMask(localPoint:Point):Boolean Checks if a certain point is inside the display object's mask. | DisplayObject | ||
local3DToGlobal(localPoint:Vector3D, out:Point = null):Point Transforms a 3D point from the local coordinate system to global (stage) coordinates. | DisplayObject | ||
localToGlobal(localPoint:Point, out:Point = null):Point Transforms a point from the local coordinate system to global (stage) coordinates. | DisplayObject | ||
Removes a child from the container. | DisplayObjectContainer | ||
removeChildAt(index:int, dispose:Boolean = false):DisplayObject Removes a child at a certain index. | DisplayObjectContainer | ||
removeChildren(beginIndex:int = 0, endIndex:int = -1, dispose:Boolean = false):void Removes a range of children from the container (endIndex included). | DisplayObjectContainer | ||
removeEventListener(type:String, listener:Function):void [override] Removes an event listener from the object. | DisplayObject | ||
removeEventListeners(type:String = null):void [override] Removes all event listeners with a certain type, or all of them if type is null. | DisplayObject | ||
removeFromParent(dispose:Boolean = false):void Removes the object from its parent, if it has one, and optionally disposes it. | DisplayObject | ||
[override] Renders the display object with the help of a painter object. | DisplayObjectContainer | ||
setChildIndex(child:DisplayObject, index:int):void Moves a child to a certain index. | DisplayObjectContainer | ||
setRequiresRedraw():void Forces the object to be redrawn in the next frame. | DisplayObject | ||
sortChildren(compareFunction:Function):void Sorts the children according to a given function (that works just like the sort function
of the Vector class). | DisplayObjectContainer | ||
Swaps the indexes of two children. | DisplayObjectContainer | ||
swapChildrenAt(index1:int, index2:int):void Swaps the indexes of two children. | DisplayObjectContainer |
Canvas | () | Constructor |
public function Canvas()
Creates a new (empty) Canvas. Call one or more of the 'draw' methods to add content.
beginFill | () | method |
public function beginFill(color:uint = 0xffffff, alpha:Number = 1.0):void
Specifies a simple one-color fill that subsequent calls to drawing methods
(such as drawCircle()
) will use.
Parameters
color:uint (default = 0xffffff )
| |
alpha:Number (default = 1.0 )
|
clear | () | method |
public function clear():void
Removes all existing vertices.
dispose | () | method |
override public function dispose():void
Disposes the resources of all children.
drawCircle | () | method |
public function drawCircle(x:Number, y:Number, radius:Number, numSides:int = -1):void
Draws a circle.
Parameters
x:Number — x-coordinate of center point
| |
y:Number — y-coordinate of center point
| |
radius:Number — radius of circle
| |
numSides:int (default = -1 ) — the number of lines used to draw the circle.
If you don't pass anything, Starling will pick a reasonable value.
|
drawEllipse | () | method |
public function drawEllipse(x:Number, y:Number, width:Number, height:Number, numSides:int = -1):void
Draws an ellipse.
Parameters
x:Number — x-coordinate of bounding box
| |
y:Number — y-coordinate of bounding box
| |
width:Number — width of the ellipse
| |
height:Number — height of the ellipse
| |
numSides:int (default = -1 ) — the number of lines used to draw the ellipse.
If you don't pass anything, Starling will pick a reasonable value.
|
drawPolygon | () | method |
public function drawPolygon(polygon:Polygon):void
Draws an arbitrary polygon.
Parameters
polygon:Polygon |
drawRectangle | () | method |
public function drawRectangle(x:Number, y:Number, width:Number, height:Number):void
Draws a rectangle.
Parameters
x:Number | |
y:Number | |
width:Number | |
height:Number |
endFill | () | method |
public function endFill():void
Resets the color to 'white' and alpha to '1'.
hitTest | () | method |
override public function hitTest(localPoint:Point):DisplayObject
Returns the object that is found topmost beneath a point in local coordinates, or nil if the test fails. Untouchable and invisible objects will cause the test to fail.
Parameters
localPoint:Point |
DisplayObject |