Flex IconItemRenderer change color on selected

80 Views Asked by At

So what i want to do is to change the style of an iconitemrenderer when the item is selected. i have tried checking the state of my item but it does not seem to worki.

<s:IconItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"  creationComplete="onStart()" stateChangeComplete="stateChangedHandler()"
                xmlns:s="library://ns.adobe.com/flex/spark"  labelField="name"  decorator="/assets/highres/customerArrow.png" iconFunction="getIcon" iconWidth="60" iconHeight="60" iconField="icon" labelFunction="getName" >

stateChangedHandler() has a trace in it which is never triggered. My final goal is to change the label from black color on normal state to white color on selected. Any ideas?

1

There are 1 best solutions below

1
Crabar On

Try something like this (not tested):

<s:IconItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"  creationComplete="onStart()" stateChangeComplete="stateChangedHandler()"
                xmlns:s="library://ns.adobe.com/flex/spark"  labelField="name"  decorator="/assets/highres/customerArrow.png" iconFunction="getIcon" iconWidth="60" iconHeight="60" iconField="icon" color.normal="0x000000" color.selected="0xffffff" labelFunction="getName">
    <s:states>
        <s:State name="normal" />
        <s:State name="selected" />
    </s:states>
</s:IconItemRenderer>