Wednesday, March 4, 2009

Flex ToggleButtonBar with icons

I had a toggle button bar but I wanted to have the buttons have labels AND icons. Knowing and working with Flex for a few years I thought "oh God, how hard is this going to be". It was actually very simple!

<mx:Array id="dp">
<mx:Object label="One" icon="@Embed(source='assets/iconOne.png')"/>
<mx:Object label="Two" icon="@Embed(source='assets/iconTwo.png')"/>
<mx:Object label="Three" icon="@Embed(source='assets/iconThree.png')"/>

<mx:ToggleButtonBar id="myBar" dataProvider="{dp}"/>

No comments: