Class Component extends MessageDispatcher
A base class for custom components.Methods
Component() constructor
Creates new Component instance.
Creates new Component instance.
onAdded(gameObject) method
Called when attached to GameObject.
Called when attached to GameObject.
onRemoved(gameObject) method
Called when detached from GameObject.
Called when detached from GameObject.
onUpdate() method
Called at every update.
Called at every update.
onRender() method
Called after all updates have been executed but before DisplayObject's onRender. GameObject itself does not have onRender method so Component#onRender will not be called on GameObjects.
This method can be used to interpolate/extrapolate values when low
Called after all updates have been executed but before DisplayObject's onRender. GameObject itself does not have onRender method so Component#onRender will not be called on GameObjects.
This method can be used to interpolate/extrapolate values when low
Black#ups
value is used.
removeFromParent() method
Detaches this Component from its parent GameObject.
Detaches this Component from its parent GameObject.
Inherited Methods
on(name, callback, context) inherited method
Adds listener by given name and callback.
Parameters
MessageBinding
Adds listener by given name and callback.
Parameters
name : string — Message name.
callback : function — Function to be called on message send.
context : * — Object to be used as
Returnscallback : function — Function to be called on message send.
context : * — Object to be used as
this
in callback function. MessageBinding
off(names) inherited method
Removes all bindings by given message name.
Parameters
void
Removes all bindings by given message name.
Parameters
names : string — One or more message name.
Returnsvoid
once(name, callback, context) inherited method
Adds listener by given name and callback. Binding will be automatically removed after first execution.
Parameters
MessageBinding
Adds listener by given name and callback. Binding will be automatically removed after first execution.
Parameters
name : string — Message name.
callback : function — Function to be called on message send.
context : * — Object to be used as
Returnscallback : function — Function to be called on message send.
context : * — Object to be used as
this
in callback function. MessageBinding
post(name, params) inherited method
Posts message with a given params.
Adding
Parameters
void
Posts message with a given params.
Adding
~
character to the begging of the name will bubble message to the top of the tree.Parameters
name : string — The name of a message
params : * — A list of params to send
Returnsparams : * — A list of params to send
void
Properties
Inherited Properties
stage : Stage | null inherited property
Returns the stage Game Object to which this belongs to or null if not added onto stage.
Returns the stage Game Object to which this belongs to or null if not added onto stage.
path : string | null inherited property
Returns string representing a url like path to this object in the display
tree.
Returns string representing a url like path to this object in the display
tree.