Flex IconItemRenderer在选中时更改颜色

时间:2014-11-09 13:25:54

标签: flex flex-mobile iconitemrenderer

所以我想要做的是在选择项目时更改iconitemrenderer的样式。我已经尝试检查我的项目的状态,但它似乎没有工作。

<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()中有一条永远不会被触发的跟踪。我的最终目标是将标签从正常状态下的黑色更改为选中的白色。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

尝试这样的事情(未经测试):

<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>