IconItemRenderer: How to display decorator only for some List items?
With Flex 4.10 and a spark List using IconItemRenderer -
is it please possible to display decorator images only for some List items?
I have a List representing a weekly Top-rating of players and wonder how to display the medal for winners only:
<fx:Declarations> <s:MultiDPIBitmapSource id="MEDAL" source160dpi="@Embed('assets/icons/160/medal-gold.png')" source240dpi="@Embed('assets/icons/240/medal-gold.png')" source320dpi="@Embed('assets/icons/320/medal-gold.png')" source480dpi="@Embed('assets/icons/480/medal-gold.png')" /> <s:ArrayCollection id="_ac" /> </fx:Declarations> <s:List id="_list" width="100%" height="100%" dataProvider="{_ac}" change="handleChange(event)"> <s:itemRenderer> <fx:Component> <s:IconItemRenderer iconField="avatar" messageField="city" decorator="{outerDocument.MEDAL}" iconFunction="{outerDocument.iconFunc}" labelFunction="{outerDocument.labelFunc}" /> </fx:Component> </s:itemRenderer> </s:List>
Answers
The short answer is to set the decorator to null in your data change function.
Longer answer:
<s:IconItemRenderer iconField="avatar" messageField="city" decorator="{outerDocument.MEDAL}" iconFunction="{outerDocument.iconFunc}" labelFunction="{outerDocument.labelFunc}" dataChange="onDataChange(event)" > <fx:Script> <![CDATA[ import mx.events.FlexEvent; public var statManager :StatManager = StatManager.instance; protected function onDataChange(event:FlexEvent):void { if(SomeConditionThatDeterminesThatDecoratorShouldBeDisplayed){ this.decorator = outerDocument.MEDAL; } else { this.decorator = null; } } ]]> </fx:Script> </s:IconItemRenderer>
I use this same approach in my mobile game.
Need Your Help
What are the pros and cons of hosting a social network (that in most probability will grow a lot quickly)on Google AppEngine?
django google-app-engine cloud cloud-hosting social-networking
I have been reading up a lot on cloud hosting and how AWS is awesome. Also this Pros & Cons of Google App Engine. I feel the above is pretty outdated. I have been deploying a lot on AppEngine and