Arslan
Arslan

Reputation: 43

Dynamically databinding radiobuttons to an arraycollection in Flex

I have an arrayCollection with strings in them, is there some way I can databind a RadioButtonGroup to the array collection? As we can do for combo boxes

var cBox:ComboBox = new ComboBox();
cBox.dataProvider = arrayCollection;

There is no RadioButtonGroup.dataprovider property. I know this has to be done manually, what is the most efficient way to do this?

Upvotes: 1

Views: 874

Answers (2)

Gregor Kiddie
Gregor Kiddie

Reputation: 3119

Or use a Repeater for the RadioButtons, all part of the same group.

Upvotes: 0

Adrian Pirvulescu
Adrian Pirvulescu

Reputation: 4340

you will need to manually create and add the radio buttons to your container ( with AS3 ) .

for each(var itemStr:String in array) 
{
    var rb:RadioButton = new RadioButton();
    rb.id = itemStr;
    rb.label = itemStr;

    container.addChild(rb); 
}

Upvotes: 1

Related Questions