Well, Rick, you say, "...repeater is meant to repeat MXML content ..."
But it is not limited to mxml content in any way.

 

You say, "...this comes with a cost..." What cost are you talking about?

 

And, "...getting down and dirty with binding and collections ..."  What
do you mean by that?  Repeater does not do anything special with
databinding or collections that you would not have to do manually using
addChild() to get the same functionality.

 

Finally, "...as a container... they sniff ..."  Repeater is not a
container.  What odor do you think you are detecting?

 

Repeater is a very effective way to dynamically populate a displayList.
There is often no reason to rewrite that code yourself.

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Rick Winscot
Sent: Thursday, March 20, 2008 11:30 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Dynamic creation of radio buttons in a
radioButtonGroup

 

But remember that the repeater is meant to repeat MXML content at run
time... and this comes with a cost - getting down and dirty with binding
and collections. Not to mention that as a container... they sniff.
Alternatives?

 

var xml:XML = <result>

                <book title="Book One"/>

                <book title="Book Two"/>

                <book title="Book Three"/>

                <book title="Book Four"/>

              </result>;

 

// Where you would pass group = "book" and the xml above...

private function createRadioGroup( group:String, xml:XML ):void

{

  for each ( var book:XML in xml.elements( group ) ) 

  {

    var rdo:RadioButton = new RadioButton();

    rdo.groupName = group;

    rdo.label = book.valueOf();

 

    // Where rdoGroup is an HBox

    rdoGroup.addChild( rdo );

  }                                            

}

 

Rick Winscot

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Thursday, March 20, 2008 1:17 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Dynamic creation of radio buttons in a
radioButtonGroup

 

mx:Repeater.  You choose the container depending on the layout you want.

Tracy

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of jeffreyr6915
Sent: Thursday, March 20, 2008 11:24 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Dynamic creation of radio buttons in a
radioButtonGroup

 

Is there a way to dynamically add new radio buttons to a
radioButtonGroup say from an xml file? I am looking for a similar
functionality to what I would receive if I were to use a dataprovider
for a comboBox (except I need to use radio buttons). Code samples are
appreciated. Thanks

 

Reply via email to