Clear Array in Actionscript3.0

来源:互联网 发布:网络语言暴力思修论文 编辑:程序博客网 时间:2024/05/16 07:57


array = [];

is equivalent to:


array = new Array();

This would not cause memory leak, but it is not recommended, for unknown reasons.


array.length = 0;

and


array.splice(array.length - 1, 1);

should be slower. 


But please note that the later reference may be wrong, because it is different from:


var deleted_people:Array = people.splice(0,people.length);


Refs:


http://newsourcemedia.com/blog/clear-delete-array-actionscript-3/

http://stackoverflow.com/questions/2237652/as3-how-to-clear-an-array-efficiently

原创粉丝点击