为什么基于图像的 itemRenderer 始终可见? [英] Why would an Image-based itemRenderer always be visible?
问题描述
给定以下代码:
<mx:DataGridColumn dataField="ongoing" id="ongoing" headerText="" width="20">
<mx:itemRenderer>
<mx:Component>
<mx:Image source="logo.jpg" visible="false" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
为什么图像总是可见的?我知道 data.ongoing 总是被设置为等于 'False',我知道图像正在获取这些信息.据我所知,这甚至不应该与它有任何关系,但我以前对 Flex 的框架感到惊讶.谢谢!
why would the image always be visible? I know for a fact that data.ongoing is always being set equal to 'False', and I know for a fact that the image is getting this information. That shouldn't even have anything to do with it, as far as I can tell, but I've been surprised by Flex's framework before. Thanks!
推荐答案
这很可能是因为 Flex 回收其 itemrenderer 以节省内存.这是之前有人问过的类似问题.
It's most likely because Flex recycles its itemrenderers to save memory. Here's a similar question that was asked before.
我要做的是覆盖 set data 方法,将图像的可见值设置为应有的值.
What I would do is override the set data method to set the image's visible value to what it should be.
这篇关于为什么基于图像的 itemRenderer 始终可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!