问题
Given the following code:
<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>
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!
回答1:
It's most likely because Flex recycles its itemrenderers to save memory. Here's a similar question that was asked before.
What I would do is override the set data method to set the image's visible value to what it should be.
来源:https://stackoverflow.com/questions/11959854/why-would-an-image-based-itemrenderer-always-be-visible