0
Explorer
,
/t5/animate-discussions/as3-best-way-to-clear-an-array/td-p/6341795
Jul 15, 2014
Jul 15, 2014
Copy link to clipboard
Copied
What is the best way to clear an array? (performance and resources)
array.length = 0;
array = [];
array.splice(0);
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Community Expert
,
Jul 15, 2014
Jul 15, 2014
array.length=0;
Community Expert
,
/t5/animate-discussions/as3-best-way-to-clear-an-array/m-p/6341796#M148548
Jul 15, 2014
Jul 15, 2014
Copy link to clipboard
Copied
array.length=0;
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
gibsy
AUTHOR
Explorer
,
/t5/animate-discussions/as3-best-way-to-clear-an-array/m-p/6341797#M148549
Jul 15, 2014
Jul 15, 2014
Copy link to clipboard
Copied
If i use something like this:
arr = new Array();
some code
.
.
.
arr = new Array()
The variable arr won't be replaced faster in the memory with this new one?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/animate-discussions/as3-best-way-to-clear-an-array/m-p/6341798#M148550
Jul 16, 2014
Jul 16, 2014
Copy link to clipboard
Copied
that's creating a new array which is extra work, and it's adding an array to the objects that flash will gc, and that's extra work.
assigning the length to 0 is the most efficient way to clear an array.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
gibsy
AUTHOR
Explorer
,
/t5/animate-discussions/as3-best-way-to-clear-an-array/m-p/6341799#M148551
Jul 16, 2014
Jul 16, 2014
Copy link to clipboard
Copied
Thanks.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/animate-discussions/as3-best-way-to-clear-an-array/m-p/6341800#M148552
Jul 17, 2014
Jul 17, 2014
Copy link to clipboard
Copied
you're welcome.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

