This is a ubiquitous 'it depends' moment.  Repeater can be very fast and can
even recycle children if need be.  In this example its simply adding
RadioButton so I'd expect it to be fast and no real loss due to no deferred
instantiation, eh?  Now, if I saw the need to use a Repeater over a custom
component based on say VBox  I could play with the creationPolicy to get
some of that deferred instantiation love.


DK

On Sat, Mar 22, 2008 at 6:19 AM, Rick Winscot <[EMAIL PROTECTED]>
wrote:

>    The mx.core.Repeater leans heavily on design-time constructs (e.g.
> MXML). Without a design-time construct and context to live in… the Repeater
> as a solution quickly becomes a kludge. Do you find Repeaters to be useful
> in ActionScript components?
>
>
>
> Cost… compare using a Repeater and one of the List types. It's all about
> deferred instantiation… which Repeaters do not take advantage of. Repeating
> anything more than a few items => use a List.
>
>
>
> From the framework docs – "Although Repeater components look like
> containers in your code, they are not containers and have none of the
> automatic layout functionality of containers. Their sole purpose is to
> specify a series of subcomponents to include in your application…" I
> understand this and can see how my comment could be mistaken. So… with
> regard to the container comment – please allow me to re-state. As an
> implementation (container) for repeated objects they aren't very efficient.
> That is what 'sniffs.' They look great on paper but perform badly.  Have you
> found situations where their benefits outweigh their baggage? If so – it
> would be great to hear about it (I mean that sincerely) or any alternatives.
>
>
>
> As for your last comment – the exact opposite is true. The Repeater is the
> least effective and most expensive way to dynamically populate a List.
>
>
>
> Rick Winscot
>
>
>
>
>
>
>
>
>
> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Tracy Spratt
> *Sent:* Friday, March 21, 2008 12:09 PM
>
> *To:* flexcoders@yahoogroups.com
> *Subject:* RE: [flexcoders] Dynamic creation of radio buttons in a
> radioButtonGroup
>
>
>
> 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
>
>   
>



-- 
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?

Reply via email to