Flex4 ToggleButtonBar with icons. Switching between states using ToggleButtonBar.

Example for Flash Builder.

ToggleButtonBar contains Home and Downloads buttons (img. 1 and img. 2) which should present icons and allow to switch between states.

This slideshow requires JavaScript.

<s:states>

<s:State name=”HomeState/>

<s:State name=”DownloadsState/>

</s:states>

<fx:Script>
<!–[CDATA[–>

import mx.events.ItemClickEvent;

protected function toggleBtnBar_itemClickHandler(event:ItemClickEvent):void
{

this.currentState = event.item.data;

}

]]>
</fx:Script>

<fx:Declarations>

<!– Place non-visual elements (e.g., services, value objects) here –>
<fx:Array id=”menuDataProvider”>

<fx:Object data=”HomeState

label=”Home

icon=”@Embed(source=’/assets/menu_icons/home.png’)/>

<fx:Object data=”DownloadsState

label=”Downloads

icon=”@Embed(source=’/assets/menu_icons/downloads.png’)/>

</fx:Array>

</fx:Declarations>

ToggleButtonBar id=”toggleBtnBar

iconField=”icon”

dataProvider=”{menuDataProvider}

itemClick=”toggleBtnBar_itemClickHandler(event)” />

Advertisements

One thought on “Flex4 ToggleButtonBar with icons. Switching between states using ToggleButtonBar.

  1. Whats up! I simply would like to give an enormous thumbs up for the great
    info you have here on this post. I will probably be coming again
    to your blog for more soon.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s