码迷,mamicode.com
首页 > 其他好文 > 详细

removeChild性能低下

时间:2016-05-07 15:01:22      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:

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();

 

removeChild性能低下

标签:

原文地址:http://www.cnblogs.com/jiangjieqim/p/5468199.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!