function testRemoveChild():void { var startTime:int = getTimer(); var count:int = 9999; for (var i:int = 0; i < count; i++) { var sp:Sprite = new Sprite(); addChild(sp); } trace("创建对象计算用时",getTimer()-startTime,"毫秒"); startTime = getTimer(); while(this.numChildren) this.removeChildAt(this.numChildren-1);; // while(this.numChildren) // this.removeChildAt(0); trace("移除对象计算用时",getTimer()-startTime,"毫秒"); } testRemoveChild();
时间: 2024-10-11 03:59:22