There are no hard rules here. I'm a code minimalist and don't like adding layers of code and display object parents unless it is really important. Adding one child is not worthy of another layer IMHO, so I'd just subclass, and I don't see why such a subclass wouldn't be reusable. See the examples on my blog (blogs.adobe.com/aharui).
The more stuff you add, the slower things get and more memory they take. MXML is convenient, but not as efficient. It's up to you. If you do composite, the trick should be propagating the data object from the container to the children. Also, you should never call addChild in a constructor. We have a component lifecycle documented for performance reasons. ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of an0one Sent: Thursday, June 19, 2008 6:45 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: How to compose a super tree item renderer using TreeItemRenderer and others Do you mean defining a subclass of TreeItemRenderer and calling addChild() in its constructor? Then it seems not easy to position and resize the embeded controls intuitively. What's worse, this subclass is of course hard to reuse. And I just gave a simplified case. What if I want a super tree item renderer consisting of a ItemRendererA, a ItemRendererB, a ControlA, a ControlB, a ControlC ... ? Don't you think it is much more convenient and elegant to combine all these controls and standard item renderers in one container using mxml than to write a item renderer subclass in AS and fill it with all these stuffs as if it is a container? (You should notice I have no hard logic to code here, but just a little layout composition to build and data bindings to make.) Now that we have mxml as a nice layout framework, why don't we make it better and let developers combine all the available elements on it to build whatever they can imagine at will? --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > Why composite? Just add the label when you subclass.