Cocos Creator API

1.4.x

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

Scene

Module: cc

cc.Scene is a subclass of cc.Node that is used only as an abstract concept.
cc.Scene and cc.Node are almost identical with the difference that users can not modify cc.Scene manually.

Properties

autoReleaseAssets Boolean

Indicates whether all (directly or indirectly) static referenced assets of this scene are releasable by default after scene unloading.

name String

Name of node.

examples:

node.name = "New Node";
cc.log("Node Name: " + node.name);

parent Node

The parent of the node.

examples:

node.parent = newNode;

uuid String readOnly

The uuid for editor, will be stripped before building project.

examples:

cc.log("Node Uuid: " + node.uuid);

skewX Number

Skew x

examples:

node.skewX = 0;
cc.log("Node SkewX: " + node.skewX);

skewY Number

Skew y

examples:

node.skewY = 0;
cc.log("Node SkewY: " + node.skewY);

zIndex Number

Z order in depth which stands for the drawing order.

examples:

node.zIndex = 1;
cc.log("Node zIndex: " + node.zIndex);

rotation Number

Rotation of node.

examples:

node.rotation = 90;
cc.log("Node Rotation: " + node.rotation);

rotationX Number

Rotation on x axis.

examples:

node.rotationX = 45;
cc.log("Node Rotation X: " + node.rotationX);

rotationY Number

Rotation on y axis.

examples:

node.rotationY = 45;
cc.log("Node Rotation Y: " + node.rotationY);

scaleX Number

Scale on x axis.

examples:

node.scaleX = 0.5;
cc.log("Node Scale X: " + node.scaleX);

scaleY Number

Scale on y axis.

examples:

node.scaleY = 0.5;
cc.log("Node Scale Y: " + node.scaleY);

x Number

x axis position of node.

examples:

node.x = 100;
cc.log("Node Position X: " + node.x);

y Number

y axis position of node.

examples:

node.y = 100;
cc.log("Node Position Y: " + node.y);

children Node[] readOnly

All children nodes.

examples:

var children = node.children;
for (var i = 0; i < children.length; ++i) {
    cc.log("Node: " + children[i]);
}

childrenCount Number readOnly

All children nodes.

examples:

var count = node.childrenCount;
cc.log("Node Children Count: " + count);

anchorX Number

Anchor point's position on x axis.

examples:

node.anchorX = 0;

anchorY Number

Anchor point's position on y axis.

examples:

node.anchorY = 0;

width Number

Width of node.

examples:

node.width = 100;

height Number

Height of node.

examples:

node.height = 100;

_ignoreAnchor Boolean private

Indicate whether ignore the anchor point property for positioning.

tag Number

Tag of node.

examples:

node.tag = 1001;

opacity Number

Opacity of node, default value is 255.

examples:

node.opacity = 255;

cascadeOpacity