add node.destroyAllChildren

This commit is contained in:
Jare Guo
2017-01-09 17:50:47 +08:00
parent 01e00c6aaa
commit 3a61a2b288
+18
View File
@@ -489,6 +489,24 @@ var Node = cc.Class({
}
},
/**
* !#en
* Destroy all children from the node, and release all their own references to other objects.<br/>
* Actual destruct operation will delayed until before rendering.
* !#zh
* 销毁所有子节点,并释放所有它们对其它对象的引用。<br/>
* 实际销毁操作会延迟到当前帧渲染前执行。
* @method destroyAllChildren
* @example
* node.destroyAllChildren();
*/
destroyAllChildren: function () {
var children = this._children;
for (var i = 0; i < children.length; ++i) {
children[i].destroy();
}
},
_onPreDestroy: function () {
var i, len;