RE: [flexcoders] variables name are in array

2009-07-29 Thread Tracy Spratt
Try:

for(var i:int = 0;i < arrName.length; i++)



 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Alexander Tarelkin
Sent: Wednesday, July 29, 2009 8:41 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] variables name are in array

 

  

Where is the breaking condition in the loop?

On Wed, Jul 22, 2009 at 12:57 AM, markflex2007 mailto:markflex2...@yahoo.com> yahoo.com> wrote:

  

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




-- 
Alexander Tarelkin
Web Developer
devexperts.com





Re: [flexcoders] variables name are in array

2009-07-29 Thread Alexander Tarelkin
Where is the breaking condition in the loop?

On Wed, Jul 22, 2009 at 12:57 AM, markflex2007 wrote:

>
>
> 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
>
>  
>



-- 
Alexander Tarelkin
Web Developer
devexperts.com


RE: [flexcoders] variables name are in array

2009-07-21 Thread Gordon Smith
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: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Keith Reinfeld
Sent: Tuesday, July 21, 2009 2:28 PM
To: flexcoders@yahoogroups.com
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: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of markflex2007
Sent: Tuesday, July 21, 2009 3:57 PM
To: flexcoders@yahoogroups.com
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



RE: [flexcoders] variables name are in array

2009-07-21 Thread Keith Reinfeld
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: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of markflex2007
Sent: Tuesday, July 21, 2009 3:57 PM
To: flexcoders@yahoogroups.com
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





[flexcoders] variables name are in array

2009-07-21 Thread markflex2007
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