Flex tilelist itemrender instance not match the da

2019-08-14 04:38发布

问题:

I use the custom itemrenderer for my Tilelist control. When I run my application. I found that the customitemrenderer's instance count was not equal to the dataprovider listItem count. There are only one item in the dataprovider list, but got 2 customitemrenderer instances. I count'd not find the reason. Can anybody help me. Many thanks!

回答1:

For list based components, flex does this for efficiency. Imagine a dataprovider with 1000 rows, but the tile list only displays 9 at a time (3X3). Having 1000 UI components created but not displayed would be a waste of memory so flex will create the 9 renderers it needs to have on the screen, plus a extra buffer amount. When you scroll through the tilelist, the renderers in the buffer will be the next ones to appear in the list, and the renderers that just scrolled off will enter the buffer to be recycled.