doodle.createElementNode
Description:
- ElementNode (element:HTMLElement, id:string) :ElementNode
-
Inherits
- Node
- Emitter
- Object
Parameters
- element:HTMLElement – [optional]
- id:string – [optional]
Returns
- ElementNode –
Throws
- SyntaxError –
Properties
- context :CanvasRenderingContext2D
-
drawing context to use
Returns
- CanvasRenderingContext2D –
- alpha :number
-
Returns
- number –
Throws
- TypeError –
- backgroundColor :Color
-
Returns
- Color –
- backgroundImage :HTMLImageElement
-
Returns
- HTMLImageElement –
Throws
- TypeError –
- backgroundRepeat :string
-
Returns
- string –
Throws
- TypeError –
- SyntaxError –
- children :Array
-
Returns
- Array –
- clearBitmap :boolean
-
Returns
- boolean –
Throws
- TypeError –
- debug.boundingBox :boolean
-
Returns
- boolean –
- element :HTMLElement
-
Returns
- HTMLElement –
- height :number
-
Returns
- number –
Throws
- TypeError –
- id :string
-
Returns
- string –
Throws
- TypeError –
- parent :Node
-
Returns
- Node –
- root :Display
-
Returns
- Display –
- rotation :number
-
Returns
- number –
- transform :Matrix
-
Returns
- Matrix –
- visible :boolean
-
Returns
- boolean –
Throws
- TypeError –
- width :number
-
Returns
- number –
Throws
- TypeError –
- x :number
-
Returns
- number –
- y :number
-
Returns
- number –
Methods
- on (type:string, listener:Function) :void
-
Adds an event listener on an Emitter object. This is convenience alias for Emitter.addListener(type, listener, useCapture=false).
Parameters
- type:string –
- listener:Function –
Throws
- TypeError –
- once (type:string, listener:Function) :void
-
Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
Parameters
- type:string –
- listener:Function –
Throws
- TypeError –
- appendTo () :Node
-
Adds this node to the given node's children.
Returns
- Node –
Throws
- TypeError –
- setChildIndex (child:Node, index:number) :void
-
Changes the position of an existing child in the node's children array. This affects the layering of child objects.
Parameters
- child:Node –
- index:number –
Throws
- TypeError –
- willTrigger (type:string) :boolean
-
Checks whether an event listener is registered with this Emitter object or any of its ancestors for the specified event type. The difference between the hasListener() and the willTrigger() methods is that hasListener() examines only the object to which it belongs, whereas the willTrigger() method examines the entire event flow for the event specified by the type parameter.
Parameters
- type:string – The type of event.
Returns
- boolean –
Throws
- TypeError –
- hasListener (type:string) :boolean
-
Checks whether the Emitter object has any listeners registered for a specific type of event.
Parameters
- type:string –
Returns
- boolean –
Throws
- TypeError –
- contains (node:Node) :boolean
-
Determine if node is among it's children, grandchildren, etc.
Parameters
- node:Node –
Returns
- boolean –
Throws
- TypeError –
- emit (event:doodle.events.Event) :boolean
-
Dispatches an event into the event flow. The event target is the Emitter object upon which the emit() method is called.
Parameters
- event:doodle.events.Event –
Returns
- boolean – true if the event was successfully dispatched.
Throws
- TypeError –
- broadcast (event:doodle.events.Event) :boolean
-
Dispatches an event to every object with an active listener. Ignores propagation path, objects come from
Parameters
- event:doodle.events.Event –
Returns
- boolean – True if the event was successfully dispatched.
Throws
- TypeError –
- Error –
- handleEvent (event:doodle.events.Event) :boolean
-
Lookup and call listener if registered for specific event type.
Parameters
- event:doodle.events.Event –
Returns
- boolean – true if node has listeners of event type.
Throws
- TypeError –
- addChildAt (node:Node, index:number) :Node
-
Parameters
- node:Node –
- index:number –
Returns
- Node –
Throws
- TypeError –
- addChild (node:Node) :Node
-
Parameters
- node:Node –
Returns
- Node –
Throws
- TypeError –
- createNode () :void
-
- createSprite () :void
-
- getChildById (id:string) :Node|undefined
-
Parameters
- id:string –
Returns
- Node|undefined –
Throws
- TypeError –
- globalToLocal (pt:Point) :Point
-
Parameters
- pt:Point –
Returns
- Point –
Throws
- TypeError –
- localToGlobal (pt:Point) :Point
-
Parameters
- pt:Point –
Returns
- Point –
Throws
- TypeError –
- removeAllChildren () :void
-
Throws
- TypeError –
- removeChildAt (index:number) :Node
-
Parameters
- index:number –
Returns
- Node – Removed child node.
Throws
- TypeError –
- RangeError –
- removeChildById (id:string) :Node
-
Parameters
- id:string –
Returns
- Node – Removed child node.
Throws
- TypeError –
- removeChild (node:Node) :Node
-
Parameters
- node:Node –
Returns
- Node – Removed child node.
Throws
- TypeError –
- ReferenceError –
- rotate (deg:number) :number
-
Parameters
- deg:number –
Returns
- number –
- scaleX (sx:number) :number
-
Parameters
- sx:number –
Returns
- number –
- scaleY (sy:number) :number
-
Parameters
- sy:number –
Returns
- number –
- swapChildren (node1:Node, node2:Node) :void
-
Parameters
- node1:Node –
- node2:Node –
Throws
- TypeError –
- addListener (type:string, listener:Function) :void
-
Registers an event listener object with an Emitter object so that the listener receives notification of an event.
Parameters
- type:string –
- listener:Function –
Throws
- TypeError –
- removeListener (type:string, listener:Function) :void
-
Removes a listener from the Emitter object.
Parameters
- type:string –
- listener:Function –
Throws
- TypeError –
- removeAllListeners (type:string) :void
-
Removes all listeners from the Emitter for the specified event.
Parameters
- type:string –
Throws
- TypeError –
- listeners (type:string) :array
-
Returns an array of listeners for the specified event.
Parameters
- type:string –
Returns
- array –
- toString () :string
-
Returns the string representation of the specified object.
Returns
- string –
- swapDepthAt (index:number) :void
-
Swap positions with another node at a given index in the parents child list.
Parameters
- index:number –
Throws
- TypeError –
- RangeError –
- swapDepths (node:Node) :void
-
Swap positions with a sibling node.
Parameters
- node:Node –
Throws
- TypeError –
- ReferenceError –
- swapChildrenAt (index1:number, index2:number) :void
-
Swaps the child nodes at the two specified index positions in the child list.
Parameters
- index1:number –
- index2:number –
Throws
- TypeError –
- RangeError –
- getBounds (targetCoordSpace:Node) :Rectangle|null
-
The bounding box of a Node is a union of all it's child Sprite's bounds.
Parameters
- targetCoordSpace:Node –
Returns
- Rectangle|null –
Class Functions
- isElementNode (obj:Object) :boolean
-
Test if an object is an ElementNode.
Parameters
- obj:Object –
Returns
- boolean –