If you have to do it in ActionScript, just use an Array of RadioButton
references: Declare

 

    var myRadioButtons:Array = [ ];

 

and then store a reference to the ith one that you create:

 

    myRadioButtons[i] = new RadioButton();

 

But it is easier to use Repeater in MXML:

 

    <mx:Repeater dataProvider="..."/>

        <mx:RadioButton id="b"/>

    </mx:Repeater>

 

You then refer to the ith repeated RadioButton as b[i].

 

The 'target' property of an Event instance is a reference to the
dispatching object -- the one that called dispatchEvent().

 

The 'currentTarget' property is a reference to the listening object --
the one that called addEventListener(). In MXML this is the one
corresponding to the tag where you put the event attribute like
click="...".

 

- Gordon

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of dj
Sent: Friday, November 17, 2006 1:08 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Iterating through a loop with radiobuttons -
giving unique instance

 

Flex Wizards:

I need to iterate through a loop and create radio buttons, i have to 
add loaders for images next to them etc. How do you something like this 
in AS3.0?

var myRadio["b"+i]:RadioButton = new RadioButton();

Also, when you send an event with the currentTarget property, which is 
the currentTarget property? I was messing with the mx:Repeater and it 
was a little confused
exactly how to set up a loop with unique id's and my make my radio 
labels dynamic that way so I am trying just to do it in as3.0

Thanks,
Patrick



 

Reply via email to