Flex4 ButtonBar设置图标不起作用

时间:2014-01-07 10:26:22

标签: flex

<s:ButtonBar id="buttonBar"  width="100%" height="100%" fontSize="15" 
                 dataProvider="{buttonBarData}" change="buttonBar_changeHandler(event)"/>
<fx:Declarations>
    <s:ArrayList id="buttonBarData">
        <fx:Object label="test" icon="{newIcon}" cmd="openfile"/>
        <fx:Object label="test" icon="{openIcon}" cmd="openfile" />
        <fx:Object label="test" icon="{saveIcon}" cmd="savefile"/>
        <fx:Object label="test" icon="{checkIcon}" cmd="check"/>
        <fx:Object label="test" icon="{undoIcon}" cmd="undo"/>
        <fx:Object label="test" icon="{redoIcon}" cmd="redo"/>
    </s:ArrayList>
</fx:Declarations>

但这不行,图标不显示,为什么会发生这种情况?

1 个答案:

答案 0 :(得分:0)

您必须在Buttonbar mxml标记中提及iconfield属性,如下所示: -

<s:ButtonBar id="buttonBar"  width="100%" height="100%" fontSize="15" 
             dataProvider="{buttonBarData}" change="buttonBar_changeHandler(event)" iconField="icon"/>

然后它才会识别从哪个字段获取图标。