There is a recommended pattern involving calling invalidateProperties()
in the .data setter, overriding commitProperties() to handle
distributing the data, and other "component lifecycle" methods.
 
There is documentation on making custom item renderers, and you can look
at the source code for mx.controls.listClasses.ListItemRenderer and
mx.controls.TextInput and other mx.controls that are IListItemRenderers.

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of droponrcll
Sent: Friday, September 28, 2007 12:29 PM
To: [email protected]
Subject: [flexcoders] MultiPurpose ItemRenderer



I'd like to be able to create a component I can use as an ItemRenderer 
or not. It already works _not_ as an ItemRenderer, but all my attempts 
to add support for the data property haven't worked. Things I've tried:

1) A creationComplete event that checks to see if data is an object of 
the right type, then sets the appropriate object to data. This throws 
a stack overflow error.

2) On the property getters, if the properties are null I set them to 
the correct properties of the data object. Since the information is 
being gotten from a bound control, this throws it into an endless loop.

I'm suspecting this is a design pattern that has been solved before, 
but I am not seeing an answer for it. Can anyone point me in the right 
direction?

Thanks.



 

Reply via email to