Node
Class
Extends _BaseNode
Module: cc
Class of all entities in Cocos Creator scenes.
For events supported by Node, please refer to Node.EventType
Index
Properties
groupIndex
Integer
Group index of node....group
String
Group of node....position
Vec2
The position (x, y) of the node in its parent's coordinates.x
Number
x axis position of node.y
Number
y axis position of node.z
Number
z axis position of node.rotation
Number
Rotation of node.angle
Number
Angle of node, the positive value is anti-clockwise direction.eulerAngles
Vec3
The rotation as Euler angles in degrees, used in 3D node.rotationX
Number
Rotation on x axis.rotationY
Number
Rotation on y axis.scale
Number
The local scale relative to the parent.scaleX
Number
Scale on x axis.scaleY
Number
Scale on y axis.scaleZ
Number
Scale on z axis.skewX
Number
Skew xskewY
Number
Skew yopacity
Number
Opacity of node, default value is 255.color
Color
Color of node, default value is white: (255, 255, 255).anchorX
Number
Anchor point's position on x axis.anchorY
Number
Anchor point's position on y axis.width
Number
Width of node.height
Number
Height of node.zIndex
Number
Node's order in children list will affect its rendering order.is3DNode
Boolean
Switch 2D/3D node.cascadeOpacity
Boolean
Cascade opacity is removed from v2.0_level
Number
_components
Component[]
_prefab
PrefabInfo
The PrefabInfo object_persistNode
Boolean
If true, the node is an persist node which won't be destroyed during scene transition.name
String
Name of node.uuid
String
The uuid for editor, will be stripped before building project.children
Node[]
All children nodes.childrenCount
Number
All children nodes.active
Boolean
The local active state of this node....activeInHierarchy
Boolean
Indicates whether this node is active in the scene.__eventTargets
EventTarget[]
Register all related EventTargets,...parent
Node
The parent of the node._name
String
_objFlags
Number
isValid
Boolean
Indicates whether the object is not yet destroyed.
Methods
constructor
on
1.once
Register an callback of a specific event type on the Node,...off
Removes the callback previously registered with the same type, callback, target and or useCapture.targetOff
Removes all callbacks previously registered with the same target.hasEventListener
Checks whether the EventTarget object has any callback registered for a specific type of event.emit
Trigger an event directly with the event name and necessary arguments.dispatchEvent
Dispatches an event into the event flow.pauseSystemEvents
Pause node related system events registered with the current Node.resumeSystemEvents
Resume node related system events registered with the current Node._getCapturingTargets
Get all the targets listening to the supplied type of event in the target's capturing phase._getBubblingTargets
Get all the targets listening to the supplied type of event in the target's bubbling phase.runAction
The node becomes the action's target.pauseAllActions
Pause all actions running on the current node.resumeAllActions
Resume all paused actions on the current node.stopAllActions
Stops and removes all actions from the running action list .stopAction
Stops and removes an action from the running action list.stopActionByTag
Removes an action from the running action list by its tag.getActionByTag
Returns an action from the running action list by its tag.getNumberOfRunningActions
Composable actions are counted as 1 action.getPosition
Returns a copy of the position (x, y, z) of the node in its parent's coordinates.setPosition
and passing two numbers (x, y) is more efficient than passing cc.Vec2 object.getScale
Returns the scale factor of the node.setScale
Sets the scale of axis in local coordinates of the node.getRotation
Get rotation of node (in quaternion).setRotation
Set rotation of node (in quaternion).getContentSize
Returns a copy the untransformed size of the node.setContentSize
All nodes has a size.getAnchorPoint
It's like a pin in the node where it is "attached" to its parent.setAnchorPoint
Sets the anchor point in percent.lookAt
Set rotation by lookAt target point, normally used by Camera NodegetLocalMatrix
Get the local transform matrix (4x4), based on parent node coordinatesgetWorldMatrix
Get the world transform matrix (4x4)convertToNodeSpaceAR
Converts a Point to node (local) space coordinates.convertToWorldSpaceAR
Converts a Point in node coordinates to world space coordinates.convertToNodeSpace
Converts a Point to node (local) space coordinates then add the anchor point position.convertToWorldSpace
Converts a Point related to the left bottom corner of the node's bounding box to world space coordinates.getNodeToParentTransform
Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates....getNodeToParentTransformAR
Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates....getNodeToWorldTransform
Returns the world affine transform matrix.getNodeToWorldTransformAR
Returns the world affine transform matrix.getParentToNodeTransform
The matrix is in Pixels.getWorldToNodeTransform
Returns the inverse world affine transform matrix.convertTouchToNodeSpace
convenience methods which take a cc.Touch instead of cc.Vec2.convertTouchToNodeSpaceAR
converts a cc.Touch (world coordinates) into a local coordinate.getBoundingBox
Returns a "local" axis aligned bounding box of the node.getBoundingBoxToWorld
Returns a "world" axis aligned bounding box of the node....addChild
Adds a child to the node with z order and name.cleanup
Stops all running actions and schedulers.sortAllChildren
Sorts the children array depends on children's zIndex and arrivalOrder,...getDisplayedOpacity
Returns the displayed opacity of Node,...getDisplayedColor
Returns the displayed color of Node,...isCascadeOpacityEnabled
Cascade opacity is removed from v2.0setCascadeOpacityEnabled
Cascade opacity is removed from v2.0setOpacityModifyRGB
Opacity modify RGB have been removed since v2.0isOpacityModifyRGB
Opacity modify RGB have been removed since v2.0getParent
Get parent of the node.setParent
Set parent of the node.attr
Properties configuration function ...getChildByUuid
Returns a child from the container given its uuid.getChildByName
Returns a child from the container given its name.insertChild
Inserts a child to the node at a specified index.getSiblingIndex
Get the sibling index.setSiblingIndex
Set the sibling index of this node.walk
Walk though the sub children tree of the current node.removeFromParent
Remove itself from its parent node.removeChild
Removes a child from the container.removeAllChildren
Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter.isChildOf
Is this node a child of the given node?getComponent
Returns the component of supplied type if the node has one attached, null if it doesn't....getComponents
Returns all components of supplied type in the node.getComponentInChildren
Returns the component of supplied type in any of its children using depth first search.getComponentsInChildren
Returns all components of supplied type in self or any of its children.addComponent
Adds a component class to the node._addComponentAt
This api should only used by undo systemremoveComponent
Removes a component identified by the given name or removes the component object given._getDependComponent
destroyAllChildren
Destroy all children from the node, and release all their own references to other objects....destroy
Actual object destruction will delayed until before rendering._destruct
Clear all references in the instance._onPreDestroy
Called before the object being destroyed._serialize
The customized serialization for this object._deserialize
Init this object from the custom serialized data.
Events
position-changed
The position changing event, you can listen to this event through the statement this.node.on(cc.Node.EventType.POSITION_CHANGED, callback, this);size-changed
The size changing event, you can listen to this event through the statement this.node.on(cc.Node.EventType.SIZE_CHANGED, callback, this);anchor-changed
The anchor changing event, you can listen to this event through the statement this.node.on(cc.Node.EventType.ANCHOR_CHANGED, callback, this);child-added
The adding child event, you can listen to this event through the statement this.node.on(cc.Node.EventType.CHILD_ADDED, callback, this);child-removed
The removing child event, you can listen to this event through the statement this.node.on(cc.Node.EventType.CHILD_REMOVED, callback, this);child-reorder
The reordering child event, you can listen to this event through the statement this.node.on(cc.Node.EventType.CHILD_REORDER, callback, this);group-changed
The group changing event, you can listen to this event through the statement this.node.on(cc.Node.EventType.GROUP_CHANGED, callback, this);active-in-hierarchy-changed
Note: This event is only emitted from the top most node whose active value did changed,...
Details
Properties
groupIndex
Group index of node.
Which Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.
meta | description |
---|---|
Type | Integer |
Defined in | cocos2d/core/CCNode.js:577 |
group
Group of node.
Which Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/CCNode.js:593 |
position
The position (x, y) of the node in its parent's coordinates.
meta | description |
---|---|
Type | Vec2 |
Defined in | cocos2d/core/CCNode.js:618 |
Examples
cc.log("Node Position: " + node.position);
x
x axis position of node.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:626 |
Examples
node.x = 100;
cc.log("Node Position X: " + node.x);
y
y axis position of node.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:669 |
Examples
node.y = 100;
cc.log("Node Position Y: " + node.y);
z
z axis position of node.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:712 |
rotation
Rotation of node.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:719 |
Deprecated | since v2.1 |
Examples
node.rotation = 90;
cc.log("Node Rotation: " + node.rotation);
angle
Angle of node, the positive value is anti-clockwise direction.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:744 |
eulerAngles
The rotation as Euler angles in degrees, used in 3D node.
meta | description |
---|---|
Type | Vec3 |
Defined in | cocos2d/core/CCNode.js:768 |
Examples
node.is3DNode = true;
node.eulerAngles = cc.v3(45, 45, 45);
cc.log("Node eulerAngles (X, Y, Z): " + node.eulerAngles.toString());
rotationX
Rotation on x axis.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:779 |
Deprecated | since v2.1 |
Examples
node.is3DNode = true;
node.eulerAngles = cc.v3(45, 0, 0);
cc.log("Node eulerAngles X: " + node.eulerAngles.x);
rotationY
Rotation on y axis.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:820 |
Deprecated | since v2.1 |
Examples
node.is3DNode = true;
node.eulerAngles = cc.v3(0, 45, 0);
cc.log("Node eulerAngles Y: " + node.eulerAngles.y);
scale
The local scale relative to the parent.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:861 |
Examples
node.scale = 1;
scaleX
Scale on x axis.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:878 |
Examples
node.scaleX = 0.5;
cc.log("Node Scale X: " + node.scaleX);
scaleY
Scale on y axis.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:904 |
Examples
node.scaleY = 0.5;
cc.log("Node Scale Y: " + node.scaleY);
scaleZ
Scale on z axis.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:930 |
skewX
Skew x
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:937 |
Examples
node.skewX = 0;
cc.log("Node SkewX: " + node.skewX);
skewY
Skew y
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:957 |
Examples
node.skewY = 0;
cc.log("Node SkewY: " + node.skewY);
opacity
Opacity of node, default value is 255.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:977 |
Examples
node.opacity = 255;
color
Color of node, default value is white: (255, 255, 255).
meta | description |
---|---|
Type | Color |
Defined in | cocos2d/core/CCNode.js:999 |
Examples
node.color = new cc.Color(255, 255, 255);
anchorX
Anchor point's position on x axis.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:1025 |
Examples
node.anchorX = 0;
anchorY
Anchor point's position on y axis.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:1048 |
Examples
node.anchorY = 0;
width
Width of node.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:1071 |
Examples
node.width = 100;
height
Height of node.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:1101 |
Examples
node.height = 100;
zIndex
zIndex is the 'key' used to sort the node relative to its siblings.
The value of zIndex should be in the range between cc.macro.MIN_ZINDEX and cc.macro.MAX_ZINDEX.
The Node's parent will sort all its children based on the zIndex value and the arrival order.
Nodes with greater zIndex will be sorted after nodes with smaller zIndex.
If two nodes have the same zIndex, then the node that was added first to the children's array will be in front of the other node in the array.
Node's order in children list will affect its rendering order. Parent is always rendering before all children.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/CCNode.js:1131 |
Examples
node.zIndex = 1;
cc.log("Node zIndex: " + node.zIndex);
is3DNode
!en Switch 2D/3D node. The 2D nodes will run faster. !zh 切换 2D/3D 节点,2D 节点会有更高的运行效率
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/CCNode.js:3288 |
cascadeOpacity
Cascade opacity is removed from v2.0 Indicate whether node's opacity value affect its child nodes, default value is true.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/CCNode.js:3385 |
Deprecated | since v2.0 |
_level
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/utils/base-node.js:151 |
_components
meta | description |
---|---|
Type | Component[] |
Defined in | cocos2d/core/utils/base-node.js:159 |
_prefab
The PrefabInfo object
meta | description |
---|---|
Type | PrefabInfo |
Defined in | cocos2d/core/utils/base-node.js:168 |
_persistNode
If true, the node is an persist node which won't be destroyed during scene transition. If false, the node will be destroyed automatically when loading a new scene. Default is false.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/utils/base-node.js:176 |
name
Name of node.
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/utils/base-node.js:200 |
Examples
node.name = "New Node";
cc.log("Node Name: " + node.name);
uuid
The uuid for editor, will be stripped before building project.
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/utils/base-node.js:222 |
Examples
cc.log("Node Uuid: " + node.uuid);
children
All children nodes.
meta | description |
---|---|
Type | Node[] |
Defined in | cocos2d/core/utils/base-node.js:237 |
Examples
var children = node.children;
for (var i = 0; i < children.length; ++i) {
cc.log("Node: " + children[i]);
}
childrenCount
All children nodes.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/utils/base-node.js:255 |
Examples
var count = node.childrenCount;
cc.log("Node Children Count: " + count);
active
The local active state of this node.
Note that a Node may be inactive because a parent is not active, even if this returns true.
Use Node/activeInHierarchy:property if you want to check if the Node is actually treated as active in the scene.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/utils/base-node.js:271 |
Examples
node.active = false;
activeInHierarchy
Indicates whether this node is active in the scene.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/utils/base-node.js:305 |
Examples
cc.log("activeInHierarchy: " + node.activeInHierarchy);
__eventTargets
Register all related EventTargets, all event callbacks will be removed in _onPreDestroy
meta | description |
---|---|
Type | EventTarget[] |
Defined in | cocos2d/core/utils/base-node.js:331 |
parent
The parent of the node.
meta | description |
---|---|
Type | Node |
Defined in | cocos2d/core/utils/base-node.js:342 |
Examples
cc.log("Node Parent: " + node.parent);
_name
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCObject.js:76 |
_objFlags
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCObject.js:83 |
isValid
Indicates whether the object is not yet destroyed. (It will not be available after being destroyed)
When an object'sdestroy
is called, it is actually destroyed after the end of this frame. SoisValid
will return false from the next frame, whileisValid
in the current frame will still be true. If you want to determine whether the current frame has calleddestroy
, usecc.isValid(obj, true)
, but this is often caused by a particular logical requirements, which is not normally required.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/platform/CCObject.js:258 |
Examples
var node = new cc.Node();
cc.log(node.isValid); // true
node.destroy();
cc.log(node.isValid); // true, still valid in this frame
// after a frame...
cc.log(node.isValid); // false, destroyed in the end of last frame
Methods
constructor
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1173 |
Parameters
name
String
on
Register a callback of a specific event type on Node.
Use this method to register touch or mouse event permit propagation based on scene graph,
These kinds of event are triggered with dispatchEvent, the dispatch process has three steps:
- Capturing phase: dispatch in capture targets (
_getCapturingTargets
), e.g. parents in node tree, from root to the real target - At target phase: dispatch to the listeners of the real target
- Bubbling phase: dispatch in bubble targets (
_getBubblingTargets
), e.g. parents in node tree, from the real target to root
In any moment of the dispatching process, it can be stopped viaevent.stopPropagation()
orevent.stopPropagationImmidiate()
.
It's the recommended way to register touch/mouse event for Node,
please do not use cc.eventManager directly for Node.
You can also register custom event and useemit
to trigger custom event on Node.
For such events, there won't be capturing and bubbling phase, your event will be dispatched directly to its listeners registered on the same node.
You can also pass event callback parameters withemit
by passing parameters aftertype
.
meta | description |
---|---|
Returns | Function |
Defined in | cocos2d/core/CCNode.js:1472 |
Parameters
type
String | Node.EventType A string representing the event type to listen for.
See Node/EventTyupe/POSITION_CHANGED for all builtin events.callback
Function The callback that will be invoked when the event is dispatched. The callback is ignored if it is a duplicate (the callbacks are unique).event
Event | Any event or first argument when emitarg2
Any arg2arg3
Any arg3arg4
Any arg4arg5
Any arg5
target
Object The target (this object) to invoke the callback, can be nulluseCapture
Boolean When set to true, the listener will be triggered at capturing phase which is ahead of the final target emit, otherwise it will be triggered during bubbling phase.
Examples
this.node.on(cc.Node.EventType.TOUCH_START, this.memberFunction, this); // if "this" is component and the "memberFunction" declared in CCClass.
node.on(cc.Node.EventType.TOUCH_START, callback, this);
node.on(cc.Node.EventType.TOUCH_MOVE, callback, this);
node.on(cc.Node.EventType.TOUCH_END, callback, this);
node.on(cc.Node.EventType.TOUCH_CANCEL, callback, this);
node.on(cc.Node.EventType.ANCHOR_CHANGED, callback);
node.on(cc.Node.EventType.COLOR_CHANGED, callback);
once
Register an callback of a specific event type on the Node, the callback will remove itself after the first time it is triggered.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1551 |
Parameters
type
String A string representing the event type to listen for.callback
Function The callback that will be invoked when the event is dispatched.The callback is ignored if it is a duplicate (the callbacks are unique).
event
Event | Any event or first argument when emitarg2
Any arg2arg3
Any arg3arg4
Any arg4arg5
Any arg5
target
Object The target (this object) to invoke the callback, can be null
Examples
node.once(cc.Node.EventType.ANCHOR_CHANGED, callback);
off
Removes the callback previously registered with the same type, callback, target and or useCapture. This method is merely an alias to removeEventListener.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1628 |
Parameters
type
String A string representing the event type being removed.callback
Function The callback to remove.target
Object The target (this object) to invoke the callback, if it's not given, only callback without target will be removeduseCapture
Boolean When set to true, the listener will be triggered at capturing phase which is ahead of the final target emit, otherwise it will be triggered during bubbling phase.
Examples
this.node.off(cc.Node.EventType.TOUCH_START, this.memberFunction, this);
node.off(cc.Node.EventType.TOUCH_START, callback, this.node);
node.off(cc.Node.EventType.ANCHOR_CHANGED, callback, this);
targetOff
Removes all callbacks previously registered with the same target.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1716 |
Parameters
target
Object The target to be searched for all related callbacks
Examples
node.targetOff(target);
hasEventListener
Checks whether the EventTarget object has any callback registered for a specific type of event.
meta | description |
---|---|
Returns | Boolean |
Defined in | cocos2d/core/CCNode.js:1767 |
Parameters
type
String The type of event.
emit
Trigger an event directly with the event name and necessary arguments.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1785 |
Parameters
type
String event typearg1
Any First argument in callbackarg2
Any Second argument in callbackarg3
Any Third argument in callbackarg4
Any Fourth argument in callbackarg5
Any Fifth argument in callback
Examples
eventTarget.emit('fire', event);
eventTarget.emit('fire', message, emitter);
dispatchEvent
Dispatches an event into the event flow. The event target is the EventTarget object upon which the dispatchEvent() method is called.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1809 |
Parameters
event
Event The Event object that is dispatched into the event flow
pauseSystemEvents
Pause node related system events registered with the current Node. Node system events includes touch and mouse events. If recursive is set to true, then this API will pause the node system events for the node and all nodes in its sub node tree. Reference: http://docs.cocos2d-x.org/editors_and_tools/creator-chapters/scripting/internal-events/
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1823 |
Parameters
recursive
Boolean Whether to pause node system events on the sub node tree.
Examples
node.pauseSystemEvents(true);
resumeSystemEvents
Resume node related system events registered with the current Node. Node system events includes touch and mouse events. If recursive is set to true, then this API will resume the node system events for the node and all nodes in its sub node tree. Reference: http://docs.cocos2d-x.org/editors_and_tools/creator-chapters/scripting/internal-events/
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1839 |
Parameters
recursive
Boolean Whether to resume node system events on the sub node tree.
Examples
node.resumeSystemEvents(true);
_getCapturingTargets
Get all the targets listening to the supplied type of event in the target's capturing phase. The capturing phase comprises the journey from the root to the last node BEFORE the event target's node. The result should save in the array parameter, and MUST SORT from child nodes to parent nodes.
Subclasses can override this method to make event propagable.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1904 |
Parameters
Examples
----------
Subclasses can override this method to make event propagable
```js
for (var target = this._parent; target; target = target._parent) {
if (target._capturingListeners && target._capturingListeners.hasEventListener(type)) {
array.push(target);
}
}
_getBubblingTargets
Get all the targets listening to the supplied type of event in the target's bubbling phase. The bubbling phase comprises any SUBSEQUENT nodes encountered on the return trip to the root of the tree. The result should save in the array parameter, and MUST SORT from child nodes to parent nodes.
Subclasses can override this method to make event propagable.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1926 |
Parameters
runAction
Executes an action, and returns the action that is executed.
The node becomes the action's target. Refer to cc.Action's getTarget()
Calling runAction while the node is not active won't have any effect.
Note:You shouldn't modify the action after runAction, that won't take any effect.
if you want to modify, when you define action plus.
meta | description |
---|---|
Returns | Action |
Defined in | cocos2d/core/CCNode.js:1948 |
Parameters
action
Action
Examples
var action = cc.scaleTo(0.2, 1, 0.6);
node.runAction(action);
node.runAction(action).repeatForever(); // fail
node.runAction(action.repeatForever()); // right
pauseAllActions
Pause all actions running on the current node. Equals to cc.director.getActionManager().pauseTarget(node)
.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1977 |
Examples
node.pauseAllActions();
resumeAllActions
Resume all paused actions on the current node. Equals to cc.director.getActionManager().resumeTarget(node)
.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1988 |
Examples
node.resumeAllActions();
stopAllActions
Stops and removes all actions from the running action list .
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:1999 |
Examples
node.stopAllActions();
stopAction
Stops and removes an action from the running action list.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:2010 |
Parameters
action
Action An action object to be removed.
Examples
var action = cc.scaleTo(0.2, 1, 0.6);
node.stopAction(action);
stopActionByTag
Removes an action from the running action list by its tag.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:2023 |
Parameters
tag
Number A tag that indicates the action to be removed.
Examples
node.stopActionByTag(1);
getActionByTag
Returns an action from the running action list by its tag.
meta | description |
---|---|
Returns | Action |
Defined in | cocos2d/core/CCNode.js:2039 |
Parameters
tag
Number
Examples
var action = node.getActionByTag(1);
getNumberOfRunningActions
Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays).
Composable actions are counted as 1 action. Example:
If you are running 1 Sequence of 7 actions, it will return 1.
If you are running 7 Sequences of 2 actions, it will return 7.</p>
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/CCNode.js:2059 |
Examples
var count = node.getNumberOfRunningActions();
cc.log("Running Action Count: " + count);
getPosition
Returns a copy of the position (x, y, z) of the node in its parent's coordinates. You can pass a cc.Vec2 or cc.Vec3 as the argument to receive the return values.
meta | description |
---|---|
Returns | Vec2 | Vec3 |
Defined in | cocos2d/core/CCNode.js:2085 |
Parameters
Examples
cc.log("Node Position: " + node.getPosition());
setPosition
Sets the position (x, y, z) of the node in its parent's coordinates.
Usually we use cc.v2(x, y) to compose cc.Vec2 object,
and passing two numbers (x, y) is more efficient than passing cc.Vec2 object.
For 3D node we can use cc.v3(x, y, z) to compose cc.Vec3 object,
and passing three numbers (x, y, z) is more efficient than passing cc.Vec3 object.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:2103 |
Parameters
newPosOrX
Vec2 | Vec3 | Number X coordinate for position or the position (x, y, z) of the node in coordinatesy
Number Y coordinate for positionz
Number Z coordinate for position
getScale
Returns the scale factor of the node. Need pass a cc.Vec2 or cc.Vec3 as the argument to receive the return values.
meta | description |
---|---|
Returns | Vec2 | Vec3 |
Defined in | cocos2d/core/CCNode.js:2167 |
Parameters
Examples
cc.log("Node Scale: " + node.getScale(cc.v3()));
setScale
Sets the scale of axis in local coordinates of the node. You can operate 2 axis in 2D node, and 3 axis in 3D node.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:2190 |
Parameters
Examples
node.setScale(cc.v2(2, 2));
node.setScale(cc.v3(2, 2, 2)); // for 3D node
node.setScale(2);
getRotation
Get rotation of node (in quaternion). Need pass a cc.Quat as the argument to receive the return values.
meta | description |
---|---|
Returns | Quat |
Defined in | cocos2d/core/CCNode.js:2226 |
Parameters
out
Quat
setRotation
Set rotation of node (in quaternion).
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:2248 |
Parameters
quat
cc.Quat | Number Quaternion object represents the rotation or the x value of quaterniony
Number y value of quternionz
Number z value of quternionw
Number w value of quternion
getContentSize
Returns a copy the untransformed size of the node.
The contentSize remains the same no matter the node is scaled or rotated.
All nodes has a size. Layer and Scene has the same size of the screen by default.
meta | description |
---|---|
Returns | Size |
Defined in | cocos2d/core/CCNode.js:2293 |
Examples
cc.log("Content Size: " + node.getContentSize());
setContentSize
Sets the untransformed size of the node.
The contentSize remains the same no matter the node is scaled or rotated.
All nodes has a size. Layer and Scene has the same size of the screen.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:2308 |
Parameters
size
Size | Number The untransformed size of the node or The untransformed size's width of the node.height
Number The untransformed size's height of the node.
Examples
node.setContentSize(cc.size(100, 100));
node.setContentSize(100, 100);
getAnchorPoint
Returns a copy of the anchor point.
Anchor point is the point around which all transformations and positioning manipulations take place.
It's like a pin in the node where it is "attached" to its parent.
The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.
But you can use values higher than (1,1) and lower than (0,0) too.
The default anchor point is (0.5,0.5), so it starts at the center of the node.
meta | description |
---|---|
Returns | Vec2 |
Defined in | cocos2d/core/CCNode.js:2351 |
Examples
cc.log("Node AnchorPoint: " + node.getAnchorPoint());
setAnchorPoint
Sets the anchor point in percent.
anchor point is the point around which all transformations and positioning manipulations take place.
It's like a pin in the node where it is "attached" to its parent.
The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.
But you can use values higher than (1,1) and lower than (0,0) too.
The default anchor point is (0.5,0.5), so it starts at the center of the node.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:2375 |
Parameters
point
Vec2 | Number The anchor point of node or The x axis anchor of node.y
Number The y axis anchor of node.
Examples
node.setAnchorPoint(cc.v2(1, 1));
node.setAnchorPoint(1, 1);
lookAt
Set rotation by lookAt target point, normally used by Camera Node
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:2588 |
Parameters
getLocalMatrix
Get the local transform matrix (4x4), based on parent node coordinates
meta | description |
---|---|
Returns | Mat4 |
Defined in | cocos2d/core/CCNode.js:2725 |
Parameters
out
Mat4 The matrix object to be filled with data
Examples
let mat4 = cc.mat4();
node.getLocalMatrix(mat4);
getWorldMatrix
Get the world transform matrix (4x4)
meta | description |
---|---|
Returns | Mat4 |
Defined in | cocos2d/core/CCNode.js:2741 |
Parameters
out
Mat4 The matrix object to be filled with data
Examples
let mat4 = cc.mat4();
node.getWorldMatrix(mat4);
convertToNodeSpaceAR
Converts a Point to node (local) space coordinates.
meta | description |
---|---|
Returns | Vec3 | Vec2 |
Defined in | cocos2d/core/CCNode.js:2757 |
Parameters
Examples
var newVec2 = node.convertToNodeSpaceAR(cc.v2(100, 100));
var newVec3 = node.convertToNodeSpaceAR(cc.v3(100, 100, 100));
convertToWorldSpaceAR
Converts a Point in node coordinates to world space coordinates.
meta | description |
---|---|
Returns | Vec3 | Vec2 |
Defined in | cocos2d/core/CCNode.js:2784 |
Parameters
Examples
var newVec2 = node.convertToWorldSpaceAR(cc.v2(100, 100));
var newVec3 = node.convertToWorldSpaceAR(cc.v3(100, 100, 100));
convertToNodeSpace
Converts a Point to node (local) space coordinates then add the anchor point position. So the return position will be related to the left bottom corner of the node's bounding box. This equals to the API behavior of cocos2d-x, you probably want to use convertToNodeSpaceAR instead
meta | description |
---|---|
Returns | Vec2 |
Defined in | cocos2d/core/CCNode.js:2810 |
Deprecated | since v2.1.3 |
Parameters
worldPoint
Vec2
Examples
var newVec2 = node.convertToNodeSpace(cc.v2(100, 100));
convertToWorldSpace
Converts a Point related to the left bottom corner of the node's bounding box to world space coordinates. This equals to the API behavior of cocos2d-x, you probably want to use convertToWorldSpaceAR instead
meta | description |
---|---|
Returns | Vec2 |
Defined in | cocos2d/core/CCNode.js:2834 |
Deprecated | since v2.1.3 |
Parameters
nodePoint
Vec2
Examples
var newVec2 = node.convertToWorldSpace(cc.v2(100, 100));
getNodeToParentTransform
Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.
The matrix is in Pixels.
meta | description |
---|---|
Returns | AffineTransform |
Defined in | cocos2d/core/CCNode.js:2855 |
Deprecated | since v2.0 |
Parameters
out
AffineTransform The affine transform object to be filled with data
Examples
let affineTransform = cc.AffineTransform.create();
node.getNodeToParentTransform(affineTransform);
getNodeToParentTransformAR
Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.
The matrix is in Pixels.
This method is AR (Anchor Relative).
meta | description |
---|---|
Returns | AffineTransform |
Defined in | cocos2d/core/CCNode.js:2883 |
Deprecated | since v2.0 |
Parameters
out
AffineTransform The affine transform object to be filled with data
Examples
let affineTransform = cc.AffineTransform.create();
node.getNodeToParentTransformAR(affineTransform);
getNodeToWorldTransform
Returns the world affine transform matrix. The matrix is in Pixels.
meta | description |
---|---|
Returns | AffineTransform |
Defined in | cocos2d/core/CCNode.js:2908 |
Deprecated | since v2.0 |
Parameters
out
AffineTransform The affine transform object to be filled with data
Examples
let affineTransform = cc.AffineTransform.create();
node.getNodeToWorldTransform(affineTransform);
getNodeToWorldTransformAR
Returns the world affine transform matrix. The matrix is in Pixels.
This method is AR (Anchor Relative).
meta | description |
---|---|
Returns | AffineTransform |
Defined in | cocos2d/core/CCNode.js:2935 |
Deprecated | since v2.0 |
Parameters
out
AffineTransform The affine transform object to be filled with data
Examples
let affineTransform = cc.AffineTransform.create();
node.getNodeToWorldTransformAR(affineTransform);
getParentToNodeTransform
Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates.
The matrix is in Pixels. The returned transform is readonly and cannot be changed.
meta | description |
---|---|
Returns | AffineTransform |
Defined in | cocos2d/core/CCNode.js:2958 |
Deprecated | since v2.0 |
Parameters
out
AffineTransform The affine transform object to be filled with data
Examples
let affineTransform = cc.AffineTransform.create();
node.getParentToNodeTransform(affineTransform);
getWorldToNodeTransform
Returns the inverse world affine transform matrix. The matrix is in Pixels. 返回世界坐标系到节点坐标系的逆矩阵。
meta | description |
---|---|
Returns | AffineTransform |
Defined in | cocos2d/core/CCNode.js:2982 |
Deprecated | since v2.0 |
Parameters
out
AffineTransform The affine transform object to be filled with data
Examples
let affineTransform = cc.AffineTransform.create();
node.getWorldToNodeTransform(affineTransform);
convertTouchToNodeSpace
convenience methods which take a cc.Touch instead of cc.Vec2.
meta | description |
---|---|
Returns | Vec2 |
Defined in | cocos2d/core/CCNode.js:3002 |
Deprecated | since v2.0 |
Parameters
touch
Touch The touch object
Examples
var newVec2 = node.convertTouchToNodeSpace(touch);
convertTouchToNodeSpaceAR
converts a cc.Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).
meta | description |
---|---|
Returns | Vec2 |
Defined in | cocos2d/core/CCNode.js:3016 |
Deprecated | since v2.0 |
Parameters
touch
Touch The touch object
Examples
var newVec2 = node.convertTouchToNodeSpaceAR(touch);
getBoundingBox
Returns a "local" axis aligned bounding box of the node.
The returned box is relative only to its parent.
meta | description |
---|---|
Returns | Rect |
Defined in | cocos2d/core/CCNode.js:3030 |
Examples
var boundingBox = node.getBoundingBox();
getBoundingBoxToWorld
Returns a "world" axis aligned bounding box of the node.
The bounding box contains self and active children's world bounding box.
meta | description |
---|---|
Returns | Rect |
Defined in | cocos2d/core/CCNode.js:3052 |
Examples
var newRect = node.getBoundingBoxToWorld();
addChild
Adds a child to the node with z order and name.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:3118 |
Parameters
child
Node A child nodezIndex
Number Z order for drawing priority. Please refer to zIndex propertyname
String A name to identify the node easily. Please refer to name property
Examples
node.addChild(newNode, 1, "node");
cleanup
Stops all running actions and schedulers.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:3148 |
Examples
node.cleanup();
sortAllChildren
Sorts the children array depends on children's zIndex and arrivalOrder, normally you won't need to invoke this function.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:3170 |
getDisplayedOpacity
Returns the displayed opacity of Node, the difference between displayed opacity and opacity is that displayed opacity is calculated based on opacity and parent node's opacity when cascade opacity enabled.
meta | description |
---|---|
Returns | number |
Defined in | cocos2d/core/CCNode.js:3357 |
Deprecated | since v2.0, please use opacity property, cascade opacity is removed |
getDisplayedColor
Returns the displayed color of Node, the difference between displayed color and color is that displayed color is calculated based on color and parent node's color when cascade color enabled.
meta | description |
---|---|
Returns | Color |
Defined in | cocos2d/core/CCNode.js:3371 |
Deprecated | since v2.0, please use color property, cascade color is removed |
isCascadeOpacityEnabled
Cascade opacity is removed from v2.0 Returns whether node's opacity value affect its child nodes.
meta | description |
---|---|
Returns | Boolean |
Defined in | cocos2d/core/CCNode.js:3395 |
Deprecated | since v2.0 |
setCascadeOpacityEnabled
Cascade opacity is removed from v2.0 Enable or disable cascade opacity, if cascade enabled, child nodes' opacity will be the multiplication of parent opacity and its own opacity.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:3405 |
Deprecated | since v2.0 |
Parameters
cascadeOpacityEnabled
Boolean
setOpacityModifyRGB
Opacity modify RGB have been removed since v2.0 Set whether color should be changed with the opacity value, useless in ccsg.Node, but this function is override in some class to have such behavior.
meta | description |
---|---|
Defined in | cocos2d/core/CCNode.js:3415 |
Deprecated | since v2.0 |
Parameters
opacityValue
Boolean
isOpacityModifyRGB
Opacity modify RGB have been removed since v2.0 Get whether color should be changed with the opacity value.
meta | description |
---|---|
Returns | Boolean |
Defined in | cocos2d/core/CCNode.js:3426 |
Deprecated | since v2.0 |
getParent
Get parent of the node.
meta | description |
---|---|
Returns | Node |
Defined in | cocos2d/core/utils/base-node.js:350 |
Examples
var parent = this.node.getParent();
setParent
Set parent of the node.
meta | description |
---|---|
Defined in | cocos2d/core/utils/base-node.js:362 |
Parameters
value
Node
Examples
node.setParent(newNode);
attr
Properties configuration function
All properties in attrs will be set to the node,
when the setter of the node is available,
the property will be set via setter function.
meta | description |
---|---|
Defined in | cocos2d/core/utils/base-node.js:419 |
Parameters
attrs
Object Properties to be set to node
Examples
var attrs = { key: 0, num: 100 };
node.attr(attrs);
getChildByUuid
Returns a child from the container given its uuid.
meta | description |
---|---|
Returns | Node |
Defined in | cocos2d/core/utils/base-node.js:438 |
Parameters
uuid
String The uuid to find the child node.
Examples
var child = node.getChildByUuid(uuid);
getChildByName
Returns a child from the container given its name.
meta | description |
---|---|
Returns | Node |
Defined in | cocos2d/core/utils/base-node.js:461 |
Parameters
name
String A name to find the child node.
Examples
var child = node.getChildByName("Test Node");
insertChild
Inserts a child to the node at a specified index.
meta | description |
---|---|
Defined in | cocos2d/core/utils/base-node.js:499 |
Parameters
child
Node the child node to be insertedsiblingIndex
Number the sibling index to place the child in
Examples
node.insertChild(child, 2);
getSiblingIndex
Get the sibling index.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/utils/base-node.js:517 |
Examples
var index = node.getSiblingIndex();
setSiblingIndex
Set the sibling index of this node.
meta | description |
---|---|
Defined in | cocos2d/core/utils/base-node.js:534 |
Parameters
index
Number
Examples
node.setSiblingIndex(1);
walk
Walk though the sub children tree of the current node. Each node, including the current node, in the sub tree will be visited two times, before all children and after all children. This function call is not recursive, it's based on stack. Please don't walk any other node inside the walk process.
meta | description |
---|---|
Defined in | cocos2d/core/utils/base-node.js:565 |
Parameters
prefunc
Function The callback to process node when reach the node for the first timetarget
_BaseNode The current visiting node
postfunc
Function The callback to process node when re-visit the node after walked all children in its sub treetarget
_BaseNode The current visiting node
Examples
node.walk(function (target) {
console.log('Walked through node ' + target.name + ' for the first time');
}, function (target) {
console.log('Walked through node ' + target.name + ' after walked all children in its sub tree');
});
removeFromParent
Remove itself from its parent node. If cleanup is true
, then also remove all events and actions.
If the cleanup parameter is not passed, it will force a cleanup, so it is recommended that you always pass in the false
parameter when calling this API.
If the node orphan, then nothing happens.
meta | description |
---|---|
Defined in | cocos2d/core/utils/base-node.js:679 |
Parameters
cleanup
Boolean true if all actions and callbacks on this node should be removed, false otherwise.
Examples
node.removeFromParent();
node.removeFromParent(false);
removeChild
Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter. </p>
If the cleanup parameter is not passed, it will force a cleanup.
"remove" logic MUST only be on this method
If a class wants to extend the 'removeChild' behavior it only needs
to override this method.
meta | description |
---|---|
Defined in | cocos2d/core/utils/base-node.js:703 |
Parameters
child
Node The child node which will be removed.cleanup
Boolean true if all running actions and callbacks on the child node will be cleanup, false otherwise.
Examples
node.removeChild(newNode);
node.removeChild(newNode, false);
removeAllChildren
Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter.
If the cleanup parameter is not passed, it will force a cleanup.
meta | description |
---|---|
Defined in | cocos2d/core/utils/base-node.js:731 |
Parameters
cleanup
Boolean true if all running actions on all children nodes should be cleanup, false otherwise.
Examples
node.removeAllChildren();
node.removeAllChildren(false);
isChildOf
Is this node a child of the given node?
meta | description |
---|---|
Returns | Boolean |
Defined in | cocos2d/core/utils/base-node.js:762 |
Parameters
parent
Node
Examples
node.isChildOf(newNode);
getComponent
Returns the component of supplied type if the node has one attached, null if it doesn't.
You can also get component in the node by passing in the name of the script.
meta | description |
---|---|
Returns | Component |
Defined in | cocos2d/core/utils/base-node.js:785 |
Parameters
Examples
// get sprite component.
var sprite = node.getComponent(cc.Sprite);
// get custom test calss.
var test = node.getComponent("Test");
getComponents
Returns all components of supplied type in the node.
meta | description |
---|---|
Returns | Component[] |
Defined in | cocos2d/core/utils/base-node.js:812 |
Parameters
Examples
var sprites = node.getComponents(cc.Sprite);
var tests = node.getComponents("Test");
getComponentInChildren
Returns the component of supplied type in any of its children using depth first search.
meta | description |
---|---|
Returns | Component |
Defined in | cocos2d/core/utils/base-node.js:833 |
Parameters
Examples
var sprite = node.getComponentInChildren(cc.Sprite);
var Test = node.getComponentInChildren("Test");
getComponentsInChildren
Returns all components of supplied type in self or any of its children.
meta | description |
---|---|
Returns | Component[] |
Defined in | cocos2d/core/utils/base-node.js:854 |
Parameters
Examples
var sprites = node.getComponentsInChildren(cc.Sprite);
var tests = node.getComponentsInChildren("Test");
addComponent
Adds a component class to the node. You can also add component to node by passing in the name of the script.
meta | description |
---|---|
Returns | Component |
Defined in | cocos2d/core/utils/base-node.js:890 |
Parameters
Examples
var sprite = node.addComponent(cc.Sprite);
var test = node.addComponent("Test");
_addComponentAt
This api should only used by undo system
meta | description |
---|---|
Defined in | cocos2d/core/utils/base-node.js:979 |
Parameters
removeComponent
Removes a component identified by the given name or removes the component object given. You can also use component.destroy() if you already have the reference.
meta | description |
---|---|
Defined in | cocos2d/core/utils/base-node.js:1027 |
Deprecated | please destroy the component to remove it. |
Parameters
Examples
node.removeComponent(cc.Sprite);
var Test = require("Test");
node.removeComponent(Test);
_getDependComponent
meta | description |
---|---|
Returns | Component |
Defined in | cocos2d/core/utils/base-node.js:1055 |
Parameters
depended
Component
destroyAllChildren
Destroy all children from the node, and release all their own references to other objects.
Actual destruct operation will delayed until before rendering.
meta | description |
---|---|
Defined in | cocos2d/core/utils/base-node.js:1101 |
Examples
node.destroyAllChildren();
destroy
Destroy this Object, and release all its own references to other objects.
Actual object destruction will delayed until before rendering.
From the next frame, this object is not usable any more.
You can use cc.isValid(obj) to check whether the object is destroyed before accessing it.
meta | description |
---|---|
Returns | Boolean |
Defined in | cocos2d/core/platform/CCObject.js:293 |
Examples
obj.destroy();
_destruct
Clear all references in the instance.
NOTE: this method will not clear the getter or setter functions which defined in the instance of CCObject. You can override the _destruct method if you need, for example: _destruct: function () { for (var key in this) { if (this.hasOwnProperty(key)) { switch (typeof this[key]) { case 'string': this[key] = ''; break; case 'object': case 'function': this[key] = null; break; } } }
meta | description |
---|---|
Defined in | cocos2d/core/platform/CCObject.js:427 |
_onPreDestroy
Called before the object being destroyed.
meta | description |
---|---|
Defined in | cocos2d/core/platform/CCObject.js:460 |
_serialize
The customized serialization for this object. (Editor Only)
meta | description |
---|---|
Returns | object |
Defined in | cocos2d/core/platform/CCObject.js:485 |
Parameters
exporting
Boolean
_deserialize
Init this object from the custom serialized data.
meta | description |
---|---|
Defined in | cocos2d/core/platform/CCObject.js:495 |
Parameters
data
Object the serialized json datactx
_Deserializer
Events
position-changed
Event
Module: cc
The position changing event, you can listen to this event through the statement this.node.on(cc.Node.EventType.POSITION_CHANGED, callback, this);
Index
Details
size-changed
Event
Module: cc
The size changing event, you can listen to this event through the statement this.node.on(cc.Node.EventType.SIZE_CHANGED, callback, this);
Index
Details
anchor-changed
Event
Module: cc
The anchor changing event, you can listen to this event through the statement this.node.on(cc.Node.EventType.ANCHOR_CHANGED, callback, this);
Index
Details
child-added
Event
Module: cc
The adding child event, you can listen to this event through the statement this.node.on(cc.Node.EventType.CHILD_ADDED, callback, this);
Index
Details
child-removed
Event
Module: cc
The removing child event, you can listen to this event through the statement this.node.on(cc.Node.EventType.CHILD_REMOVED, callback, this);
Index
Details
child-reorder
Event
Module: cc
The reordering child event, you can listen to this event through the statement this.node.on(cc.Node.EventType.CHILD_REORDER, callback, this);
Index
Details
group-changed
Event
Module: cc
The group changing event, you can listen to this event through the statement this.node.on(cc.Node.EventType.GROUP_CHANGED, callback, this);
Index
Details
active-in-hierarchy-changed
Event
Module: cc
Note: This event is only emitted from the top most node whose active value did changed, not including its child nodes.