as question
- Started
- Last post
- 13 Responses
- REDWOOD
how can i reset an array in flash?
- san_lee0
myArray = new Array(value1,value2,value3);
if you now do this:
myArray = new Array();You start again with an empty array. no? (i cannot check this at the moment)
- rabattski0
yourarrayname = [];
- REDWOOD0
no san lee,
that doesn't work
ow and by the way how do you put code into this site?
- rabattski0
have you tried what i wrote (and no you can't really put code here).
- san_lee0
@ redwood: it does work.
copy / paste and ctrl + enter it.test = new Array(1,2,3,4,5);
trace("test "+test);
test = new Array();
trace("test "+test);
- rabattski0
not really resetting but that should def. work.
- UndoUndo0
or write a for loop that goes through every element in the array and "clears" them
- rabattski0
ehm. am i the only one that can see my posts? yourarrayname = []; is a full clearing of an array without looping and clearing elements one by one or redefining arrays.
- ozhanlion0
why noone mentioned youraarrayname = [];
it will do your job.
pulling rabattski's leg :)
- rabattski0
aaaaaaaaargh!!! :)
- UndoUndo0
its just a different approach rabattski, looping through the array will keep its length which maybe important to the guy who's asking the questions :)
- rabattski0
true. but i can't imagine someone needs the length of an array if he wants to reset it. besides you can check the length before the reset anyways. it does differ in speed though (although on fast machines it prolly won't make any noticeble difference).
- REDWOOD0
Haha you were al right, butt i saved the array info into an movieClass and read back in from there and forgot to reset that movieClass.
Stupid haha.THNX anyway.