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

Reply via email to