Yes. Google: Alex Harui itemRenderer recycle You will find a full explanation and lots of example code.
Briefly: For performance reasons, the list-based conponents only renderer enough UI elements to display what is visible to the user , plus a few for buffering. Anytime you interact with the List (or DG), like scroll, or update the underlying data, Flex manipulates the underlying list and sends the changed dataProvider item object to the appropriate itemRenderer, which must use that data to change its appearance as needed. In this recycle process, the framework calls the itemRenderer's set data() function, passing in the new item object. This means your item renderer must override set data(o:Object), and then use that passed in data to set itself up. Best practice is to save the data in a var, then call invalidateProperties(). This makes the framework, at the correct, optimized time, call the item renderer's commitProperties() method. You should do the actual UI work in this function, using the data you saved in set data(); All this is in the interest of performance on large lists. See Alex's blog for all the details. Tracy ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of tchredeemed Sent: Friday, April 04, 2008 3:05 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Question regarding <mx:List> and itemRenderer I do have a custom itemRenderer, and I am not doing anything to handle recycling. Got any documentation I can read regarding the issue? --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > You have a custom item renderer, is that correct? If so, are you > properly handling recycling, by using override set data() and > invalidateProperties()? > > > > Tracy > > > > ________________________________ > > From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of tchredeemed > Sent: Friday, April 04, 2008 11:18 AM > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Question regarding <mx:List> and itemRenderer > > > > Why is it that, when I have two lists, if I drag between the two of > them, sometimes the > itemRenderer will display data / colors from an incorrect item in the > List. > > For instance: > > List A: > [ item 1 ] > [ item 2 ] > > List B: > [ item 3 ] > [ item 4 ] > > If I move [ item 2 ] to List b: > > List A: > [ item 1 ] > > List B: > [ item 3 ] > [ item 4 ] > [ item 2 ] > > Then I move [ item 4 ] to List A: > > List A: > [ item 1 ] > [ item 4 ] > > List B: > [ item 3 ] > [ item 2 ] > > [ item 4 ] will display some properties that [ item 2 ] should have, > seemingly because I put > it in [ item 2 ]'s position in List A. > > Is this common and is there something simple to fix this? >