mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
add node.destroyAllChildren
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user