PDA

View Full Version : filling array with variables



shvalb
September 29th, 2004, 09:18 AM
Hi.
I'm interested to fill a simple array with variable names, NOT with strings! , because I need it for catching the data from asp file.
I tried something like that but it doesn't work

for(i=0; i < 9; i++)
{
Variables_array[i] = Variable + i;
trace(Variables_array[i]);
}

if I initialize the array in this form it works:

var Variables_array:Array = new Array(Variable1, Variable2, Variable3, ...);

any ideas ?

virusescu
September 29th, 2004, 09:21 AM
Try this:

Variables_array = new Array();
for(i=0; i < 9; i++)
{
Variables_array[i] = eval("Variable" + i);
trace(Variables_array[i]);
}

shvalb
September 29th, 2004, 09:23 AM
10x. body, you're a life saver!

virusescu
September 29th, 2004, 09:25 AM
with pleasure ;)