I've seen this happen during the initial setup of a component. However, I would not expect it to occur once the component is initialized, not as you scroll through the list of items. I was unclear if you had
Add in an "onDataChange" handler. IT may provide some more insight. [no guarantees though]
To figure out why, you'd have to step through the framework source.
The reason I did that test is actually because of my real problem:
The data property in the itemRenderer is not being reset, it is storing the previous value and concantenating the new values each time.
Am I missing a step? Do I have to reset or invalidate the data value in the itemRenderer on each call, for it to stop storing the previously assigned value?
Thanks for any help, Mates.
It seems like I have to purge the ItemRenderers using the following protected method:
That solved half the problem (where the data property was not being reset). So the data property is only being set once. This is good
The last bit to resolve is: my entire itemRenderer is being repeated but without the content, since the content has been purged, as per the code above.
Now, how do I clear out the itemRenderer so it is only rendered once each time? I am wondering how to use the invalidateDisplayList and if that will solve the problem.
Purging shouldn't be necessary. Your renderers shouldn't have concatenating behavior unless you are handling some corner case. The major feature of List is that it virtualizes renderers. You can have 100,000 rows of data but if only 7 rows are visible on about 7 (not exactly 7) renderers exist and are recycled to view different rows as you scroll. The memory required for 100,000 renderers is prohibitive. Because renderers are recycled, the data setter is fired often. Purging would cause performance problems because new renderers will need to be created and added to the display list.
If you don't need virtualization, consider Repeater and VBox.
Flex SDK Developer
Adobe Systems Inc.