measuring custom item renderer on a List

I'm writing an Adobe Air client to a service similar to Twitter.

On the timeline (List component) I have a custom item renderer which is basically a Canvas with a fixed-width Image and a Text control, which is multi-line.

If the text is long enough to change the Canvas height, it will only be resized if I manually change the width of the Window, forcing a redraw of all renderers. If I simply scroll through the List, all "new" renderers will have the minimum height possible (which is the Image height).

Any ideas on how to force the re-measurement of the renderer when I set it's data?

Thanks in advance! :)


尝试调用itemrender上的invalidateSize()和/或列表上的invalidateDisplayList()


I'm struggling with similar invalidation / resizing issues. This video shed some light on building custom components for me. Hope it helps.

Here is a link to a great video of an adobe engineer speaking about creating components for flex in Action script.

http://tv.adobe.com/watch/max-2008-develop/creating-new-components-in-flex-3-by-deepa-subramaniam/


你有没有尝试为列表设置variableRowHeight=true

链接地址: http://www.djcxy.com/p/5904.html

上一篇: 列表刷新,Flex中的项目渲染器

下一篇: 测量列表上的自定义项目渲染器