本文介绍了Flex tilelist itemrender 实例与数据提供程序长度不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将自定义 itemrenderer 用于我的 Tilelist 控件.当我运行我的应用程序时.我发现 customitemrenderer 的实例计数不等于 dataprovider listItem 计数.dataprovider 列表中只有一项,但有 2 个 customitemrenderer 实例.我估计找不到原因.有谁能够帮助我.非常感谢!

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!

推荐答案

对于基于列表的组件,flex 这样做是为了提高效率.想象一个有 1000 行的数据提供者,但磁贴列表一次只显示 9 个 (3X3).创建 1000 个 UI 组件但不显示会浪费内存,因此 flex 将创建它需要在屏幕上拥有的 9 个渲染器,以及额外的缓冲区量.当您滚动 tilelist 时,缓冲区中的渲染器将是下一个出现在列表中的渲染器,而刚刚滚动的渲染器将进入缓冲区进行回收.

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.

这篇关于Flex tilelist itemrender 实例与数据提供程序长度不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 13:24