Hi Douglas, If you look in the docs, you'll see that itemRenderers (and itemEditors) are the primary use cases for ClassFactory. In fact, when you say something like <mx:List id="myList" itemRenderer="ProductRenderer">, the compiler actually creates a ClassFactory instance for you behind the scenes. Explicitly creating the ClassFactory instance simply allows you to use the properties property, which is the key to making a reusable renderer. Further evidence of the correlation is that the itemRenderer and itemEditor properties are of type IFactory, which is what ClassFactory implements.
I don't want you to think I'm being defensive, its just that itemRenderers seem to be a topic that comes up repeatedly as a pain point for developers. I think if people had a better understanding of how they worked (especially the rule that you MUST override the data setter method), people could avoid a lot of headaches. The post I wrote prior to the one Darron referenced actually shows how to create a renderer in what I guess is the more traditional method (itemRenderer="MyRendererClass"), so that may be of help to you. However, the reason I initially began investigating ClassFactory was because of problems I was having getting a CheckBox to function as a headerRenderer. For reasons still unknown to me, headerRenderers seem to fire events extremely frequently, which caused difficulty getting it to respond to user interaction in a predictable way. Let me know if you have any other questions or concerns about renderers (and/or my approach to them) and I will do my best to help. Thanks, Ben --- In [email protected], "Douglas Knudsen" <[EMAIL PROTECTED]> wrote: > > thanks, been reading that. Seems like this approach is way off the > direction normally taken for renderers though, eh? Not to knock Ben mind > you. Can add checkboxes to a datagrid cell with out that, correct? So why > not headers? > > oh...answering my other question...headers are rendered by > DataGridItemRenderer by default according to the docs. > > DK > > On 23 Mar 2007 13:31:04 -0700, Darron J. Schall <[EMAIL PROTECTED]> > wrote: > > > > Check out > > > > http://www.returnundefined.com/2006/11/creating-truly-reusable-renderers-with-classfactory/ > > > > -d > > > > > > Douglas Knudsen wrote: > > > > > > How the heck to get a checkbox in the header of a data grid, eh? Let > > > me re-phrase that some...a workable checkbox. I can create a custom > > > renderer in AS to put one there, but can't click it at all. Anyone > > > have a example or a nudge? > > > > > > -- > > > Douglas Knudsen > > > http://www.cubicleman.com <http://www.cubicleman.com> > > > this is my signature, like it? > > > > > > > > > > > > > > > > -- > Douglas Knudsen > http://www.cubicleman.com > this is my signature, like it? >
