diff --git a/cocos2d/core/utils/base-node.js b/cocos2d/core/utils/base-node.js index 88058429a8..227898c648 100644 --- a/cocos2d/core/utils/base-node.js +++ b/cocos2d/core/utils/base-node.js @@ -1828,6 +1828,11 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{ if (this._reorderChildDirty) { var _children = this._children; + if (!_children) { + this._reorderChildDirty = false; + return; + } + // insertion sort var len = _children.length, i, j, child; for (i = 1; i < len; i++){ @@ -1849,7 +1854,6 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{ _children[j+1] = child; } - //don't need to check children recursively, that's done in visit of each child this._reorderChildDirty = false; this.emit(CHILD_REORDER); } diff --git a/cocos2d/deprecated.js b/cocos2d/deprecated.js index 80a503e97c..2c3e59025e 100644 --- a/cocos2d/deprecated.js +++ b/cocos2d/deprecated.js @@ -326,7 +326,6 @@ if (CC_DEV) { '_additionalTransformDirty', '_shaderProgram', 'shaderProgram', - '_reorderChildDirty', '_normalizedPositionDirty', '_normalizedPosition', '_usingNormalizedPosition', @@ -338,7 +337,6 @@ if (CC_DEV) { 'setActionManager', 'getScheduler', 'setScheduler', - 'sortAllChildren', 'reorderChild', 'draw', 'transformAncestors',