-
Is there any way to destroy an array and free up the memory it was using while an swf file is still loaded?
I have a module that is using data from Access to fill up its content. I am loading the data into flash pipe-delimited then splitting those values into seperate arrays. Depending on which button the user presses, depends on which data is queried for and loaded.
Problem is, I was only using one set of arrays to store the data in. After loading a different set of data, I was re-instantiating the arrays, figuring this would clear them out and allow me to re-use them. But I now believe it may be creating the same array name in different memory areas...???
Is there any way to clear to arrays before lading new data to them? Or should I scrap this entire process and preload all the data into their own arrays beforehand?
Also, generally, how much data is too much to be loading at one time? Would a few tables with a hundred or two rows each be too much?
Thanks for any and all responses.
-
have you tried this ?
delete MyArray;
?? check this ...
or ... myArray = undefined;
-
as far as I know, there is no way to do something like
delete myArray();
or soemthing like that.
Maybe I can use something like
myArray.slice(0);
to slice all entries from 0 to the end..??
-
see this ...
aashu = new Array("a","b","c");
trace("before deleting :" + aashu[1]);
delete aashu;
trace("after deleting :" + aashu[1]);
your solution is this ...
-
Thanks man, it helped out.
I had to seriously debug some code, but everything seems to be working fine now.
I swear I looked all over the docs for something like array.clear() or something, can couldnt find it.
Learn something new everyday.
-
one thing i found intersting ...
when i am seeing the posts of yours and me ... is 107 and 1071 ... only 1 more ... lol
-
pretty funny.. I visit here quite often, and I only have 107 posts. It's like you've been here for like 10 years.. j/k
-
-
very easy
EASY!
Code:
// just set the length to zero
// the length property is read and write
nameOfYourArray.length = 0;
-
never thought about this way!
thanks for your suggestion ... :) i thought it was readonly property.
-
nameOfYourArray.length = 0;
a good tip,but it's still in memery,so nameOfYourArray=null;/nameOfYourArray=undefined;/delete nameOfYourArray;
...
Code:
while (yourarray.length) yourarray.pop();
D:)S
-
i think then the delete will be the best.