It doesn't work because arrName[i] is the name string, not the value. This code 
is the equivalent of executing

    "myvar" = 1

What are you actually trying to do? If you need to save name/value pairs, you 
would normally just use an Object. For example, you could declare

    private var obj:Object = {};

and later set

    obj[name1] = value1;
    obj[name2] = value2;

You can then retrieve all the names and values like this:

    for (var name:String in obj)
      trace(name, obj[name]);

Gordon Smith
Adobe Flex SDK Team

From: [email protected] [mailto:[email protected]] On Behalf 
Of Keith Reinfeld
Sent: Tuesday, July 21, 2009 2:28 PM
To: [email protected]
Subject: RE: [flexcoders] variables name are in array


Because arrName.length == 0, perhaps?

Try:

for(var i:int = 0; arrValue.length; i++)
{
arrName[i] = arrValue[i];
}

Regards,

-Keith
http://keithreinfeld.home.comcast.net<http://keithreinfeld.home.comcast.net/>


________________________________
From: [email protected] [mailto:[email protected]] On Behalf 
Of markflex2007
Sent: Tuesday, July 21, 2009 3:57 PM
To: [email protected]
Subject: [flexcoders] variables name are in array



I use a array to save variable names and other to save values,but why the 
following code doesn't work.please give me a idea.

for(var i:int = 0;arrName.length; i++)
{
arrName[i] = arrValue[i];
}

Thanks a lot.

Mark

Reply via email to