[flexcoders] I need to set a label...???

2009-04-15 Thread sailorsea21
Hi everyone, I need to set a label... 

The actual label is in a ArrayCollection.
I can access is like this:
parentApplication.MyLabelArray.getItemAt(0).label001
or
parentApplication.MyLabelArray.getItemAt(0).label002
or
parentApplication.MyLabelArray.getItemAt(0).label003
and so on...

Is it possible to access the labels dynamically like this:

var labelNames:Array = new Array(label001, label002, label003);

for each(var getName:String in labelNames)
{
var radio00:RadioButton = new RadioButton();
radio00.label = this[parentApplication.MyLabelArray.getItemAt(0).getName;
}

I can't get this to work... Is there a better way to approach this?

Thanks everyone!

-David




Re: [flexcoders] I need to set a label...???

2009-04-15 Thread Paresh M More
Davidu change the loop

var labelNames:Array =
[{label:Button0},{label:Button1},{label:Button2}];

var radio00:RadioButton = new RadioButton();
radio00.label =  get_labelstring(0);

public function get_labelstring(i:int):String
{
if ( i  labelNames.length)
return  labelNames[i].valueOf().label;
}

-- 
Regards,
Paresh M. More
Senior Software Engineer

Nashik/Pune, Maharashtra, India.
Email - pareshm...@gmail.com

On Wed, Apr 15, 2009 at 5:56 PM, sailorsea21 sailorse...@yahoo.com wrote:



 Hi everyone, I need to set a label...

 The actual label is in a ArrayCollection.
 I can access is like this:
 parentApplication.MyLabelArray.getItemAt(0).label001
 or
 parentApplication.MyLabelArray.getItemAt(0).label002
 or
 parentApplication.MyLabelArray.getItemAt(0).label003
 and so on...

 Is it possible to access the labels dynamically like this:

 var labelNames:Array = new Array(label001, label002, label003);

 for each(var getName:String in labelNames)
 {
 var radio00:RadioButton = new RadioButton();
 radio00.label = this[parentApplication.MyLabelArray.getItemAt(0).getName;
 }

 I can't get this to work... Is there a better way to approach this?

 Thanks everyone!

 -David

  



Re: [flexcoders] I need to set a label...???

2009-04-15 Thread Paul Andrews
- Original Message - 
From: sailorsea21 sailorse...@yahoo.com
To: flexcoders@yahoogroups.com
Sent: Wednesday, April 15, 2009 1:26 PM
Subject: [flexcoders] I need to set a label...???


 Hi everyone, I need to set a label...

 The actual label is in a ArrayCollection.
 I can access is like this:
 parentApplication.MyLabelArray.getItemAt(0).label001
 or
 parentApplication.MyLabelArray.getItemAt(0).label002
 or
 parentApplication.MyLabelArray.getItemAt(0).label003
 and so on...

 Is it possible to access the labels dynamically like this:

 var labelNames:Array = new Array(label001, label002, label003);

 for each(var getName:String in labelNames)
 {
 var radio00:RadioButton = new RadioButton();
 radio00.label = this[parentApplication.MyLabelArray.getItemAt(0).getName;
 }

 I can't get this to work... Is there a better way to approach this?

How about:

parentApplication.MyLabelArray.getItemAt(0)[label003]

Paul





 Thanks everyone!

 -David




 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups 
 Links






Re: [flexcoders] I need to set a label...???

2009-04-15 Thread - -
Hi Paresh  Paul, both your ideas worked!

Thanks again :)





From: Paul Andrews p...@ipauland.com
To: flexcoders@yahoogroups.com
Sent: Wednesday, April 15, 2009 10:08:48 AM
Subject: Re: [flexcoders] I need to set a label...???





- Original Message - 
From: sailorsea21 sailorsea21@ yahoo.com
To: flexcod...@yahoogro ups.com
Sent: Wednesday, April 15, 2009 1:26 PM
Subject: [flexcoders] I need to set a label...???

 Hi everyone, I need to set a label...

 The actual label is in a ArrayCollection.
 I can access is like this:
 parentApplication. MyLabelArray. getItemAt( 0).label001
 or
 parentApplication. MyLabelArray. getItemAt( 0).label002
 or
 parentApplication. MyLabelArray. getItemAt( 0).label003
 and so on...

 Is it possible to access the labels dynamically like this:

 var labelNames:Array = new Array(label001 , label002, label003);

 for each(var getName:String in labelNames)
 {
 var radio00:RadioButton = new RadioButton( );
 radio00.label = this[parentApplicat ion.MyLabelArray .getItemAt( 0).getName;
 }

 I can't get this to work... Is there a better way to approach this?

How about:

parentApplication. MyLabelArray. getItemAt( 0)[label003 ]

Paul


 Thanks everyone!

 -David




  - - --

 --
 Flexcoders Mailing List
 FAQ: http://groups. yahoo.com/ group/flexcoders /files/flexcoder sFAQ.txt
 Alternative FAQ location: 
 https://share. acrobat.com/ adc/document. do?docid= 942dbdc8- e469-446f- 
 b4cf-1e62079f684 7
 Search Archives: 
 http://www.mail- archive.com/ flexcoders% 40yahoogroups. comYahoo! Groups 
 Links








  

RE: [flexcoders] I need to set a label...???

2009-04-15 Thread Tracy Spratt
Where is it failing?  If you step into your getName() method, does it find
and return the correct value?  You have implemented such a method on your
item class, correct?

 

Further, you declare an initialize  the array labelNames, but never use it.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of sailorsea21
Sent: Wednesday, April 15, 2009 8:27 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] I need to set a label...???

 






Hi everyone, I need to set a label... 

The actual label is in a ArrayCollection.
I can access is like this:
parentApplication.MyLabelArray.getItemAt(0).label001
or
parentApplication.MyLabelArray.getItemAt(0).label002
or
parentApplication.MyLabelArray.getItemAt(0).label003
and so on...

Is it possible to access the labels dynamically like this:

var labelNames:Array = new Array(label001, label002, label003);

for each(var getName:String in labelNames)
{
var radio00:RadioButton = new RadioButton();
radio00.label = this[parentApplication.MyLabelArray.getItemAt(0).getName;
}

I can't get this to work... Is there a better way to approach this?

Thanks everyone!

-David