<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; ButtonBar</title>
	<atom:link href="http://blog.flexexamples.com/category/halo/buttonbar/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Changing the label placement on an MX ButtonBar control in Flex (redux)</title>
		<link>http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/</link>
		<comments>http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 02:23:51 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ButtonBar]]></category>
		<category><![CDATA[iconField]]></category>
		<category><![CDATA[labelField]]></category>
		<category><![CDATA[labelPlacement]]></category>
		<category><![CDATA[mx_internal]]></category>
		<category><![CDATA[navItemFactory]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3433</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/01/08/changing-the-label-placement-for-a-flex-buttonbar-control/">&#8220;Changing the label placement for a Flex ButtonBar control&#8221;</a>, we saw how you could change the button&#8217;s label placement relative to its icon in a ButtonBar control in Flex by using the getChildAt() method and labelPlacement property.</p> <p>The following example shows how you can set the label/icon placement on an [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/01/08/changing-the-label-placement-for-a-flex-buttonbar-control/">&#8220;Changing the label placement for a Flex ButtonBar control&#8221;</a>, we saw how you could change the button&#8217;s label placement relative to its icon in a ButtonBar control in Flex by using the <code>getChildAt()</code> method and <code>labelPlacement</code> property.</p>
<p>The following example shows how you can set the label/icon placement on an MX ButtonBar control in Flex by extending the MX ButtonBar class and setting the <code>navItemFactory</code> property in the  <code>mx_internal</code> namespace to a custom class.</p>
<p><span id="more-3433"></span></p>
<p class="alert">Since this example uses the <strong>mx_internal</strong> namespace, you can't always depend on this behavior to work in future versions of the Flex SDK. Use at your own risk.</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;MX_ButtonBar_navItemFactory_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        xmlns:local=<span style="color: #ff0000;">&quot;*&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;local:CustomButtonBar</span> id=<span style="color: #ff0000;">&quot;bb&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;{viewstack}&quot;</span></span>
<span style="color: #000000;">            labelField=<span style="color: #ff0000;">&quot;label&quot;</span></span>
<span style="color: #000000;">            iconField=<span style="color: #ff0000;">&quot;icon&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;300&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ViewStack</span> id=<span style="color: #ff0000;">&quot;viewstack&quot;</span></span>
<span style="color: #000000;">            backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;300&quot;</span> height=<span style="color: #ff0000;">&quot;100&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> id=<span style="color: #ff0000;">&quot;tab_1&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Tab 1&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('Assets.swf#CloseButtonUp')&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Canvas</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> id=<span style="color: #ff0000;">&quot;tab_2&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Tab 2&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('Assets.swf#CloseButtonOver')&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ColorPicker</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Canvas</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> id=<span style="color: #ff0000;">&quot;tab_3&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Tab 3&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('Assets.swf#CloseButtonOver')&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ComboBox</span> dataProvider=<span style="color: #ff0000;">&quot;[red,orange,yellow,green,blue]&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Canvas</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ViewStack</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>The custom MX ButtonBar control, <em>CustomButtonBar.as</em>, is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/** http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/ */</span>
<span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>controls<span style="color: #000066; font-weight: bold;">.</span>ButtonBar<span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>ClassFactory<span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>mx_internal<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> CustomButtonBar <span style="color: #0033ff; font-weight: bold;">extends</span> ButtonBar <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomButtonBar<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
            mx_internal<span style="color: #000066; font-weight: bold;">::</span>navItemFactory = <span style="color: #0033ff; font-weight: bold;">new</span> ClassFactory<span style="color: #000000;">&#40;</span>CustomButtonBarButton<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>And the custom nav item factory, <em>CustomButtonBarButton.as</em>, is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/** http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/ */</span>
<span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>controls<span style="color: #000066; font-weight: bold;">.</span>buttonBarClasses<span style="color: #000066; font-weight: bold;">.</span>ButtonBarButton<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> CustomButtonBarButton <span style="color: #0033ff; font-weight: bold;">extends</span> ButtonBarButton <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomButtonBarButton<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
            labelPlacement = <span style="color: #990000;">&quot;top&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Changing the label placement on an MX ButtonBar control in Flex (redux) on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/',contentID: 'post-3433',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'iconField,labelField,labelPlacement,mx_internal,navItemFactory',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting an image background on a Halo ButtonBar control in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/07/09/setting-an-image-background-on-a-halo-buttonbar-control-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/07/09/setting-an-image-background-on-a-halo-buttonbar-control-in-flex-4/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 06:59:17 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta1]]></category>
		<category><![CDATA[ButtonBar]]></category>
		<category><![CDATA[buttonStyleName]]></category>
		<category><![CDATA[firstButtonStyleName]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[lastButtonStyleName]]></category>
		<category><![CDATA[skin]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=1474</guid>
		<description><![CDATA[<p>The following example shows how you can set an image background on a Halo ButtonBar control (with default Spark skin) in Flex 4 by setting the buttonStyleName, firstButtonStyleName, lastButtonStyleName, and skin styles.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2009/07/09/setting-an-image-background-on-a-halo-buttonbar-control-in-flex-4/ --&#62; &#60;s:Application name=&#34;Halo_ButtonBar_buttonStyleName_test&#34; xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/halo&#34;&#62; &#160; &#60;fx:Style&#62; @namespace s &#34;library://ns.adobe.com/flex/spark&#34;; @namespace [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set an image background on a Halo ButtonBar control (with default Spark skin) in Flex 4 by setting the <code>buttonStyleName</code>, <code>firstButtonStyleName</code>, <code>lastButtonStyleName</code>, and <code>skin</code> styles.</p>
<p>Full code after the jump.</p>
<p><span id="more-1474"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/07/09/setting-an-image-background-on-a-halo-buttonbar-control-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Halo_ButtonBar_buttonStyleName_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        @namespace s &quot;library://ns.adobe.com/flex/spark&quot;;
        @namespace mx &quot;library://ns.adobe.com/flex/halo&quot;;
&nbsp;
        .buttonBarButtonStyles {
            skin: ClassReference(&quot;skins.CustomButtonBarButtonSkin&quot;);
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ButtonBar</span> id=<span style="color: #ff0000;">&quot;btnBar&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;[The,Quick,Brown,Fox,Jumps,Over,The,Lazy,Dog]&quot;</span></span>
<span style="color: #000000;">            buttonStyleName=<span style="color: #ff0000;">&quot;buttonBarButtonStyles&quot;</span></span>
<span style="color: #000000;">            firstButtonStyleName=<span style="color: #ff0000;">&quot;buttonBarButtonStyles&quot;</span></span>
<span style="color: #000000;">            lastButtonStyleName=<span style="color: #ff0000;">&quot;buttonBarButtonStyles&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>The custom ButtonBar button skin class, skins/CustomButtonBarButtonSkin.mxml, is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/07/09/setting-an-image-background-on-a-halo-buttonbar-control-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SparkSkin</span> name=<span style="color: #ff0000;">&quot;CustomButtonBarButtonSkin&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        minWidth=<span style="color: #ff0000;">&quot;21&quot;</span> minHeight=<span style="color: #ff0000;">&quot;21&quot;</span></span>
<span style="color: #000000;">        alpha.disabledStates=<span style="color: #ff0000;">&quot;0.5&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- states --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:states</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;up&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;over&quot;</span> stateGroups=<span style="color: #ff0000;">&quot;overStates&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;down&quot;</span> stateGroups=<span style="color: #ff0000;">&quot;downStates&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;disabled&quot;</span> stateGroups=<span style="color: #ff0000;">&quot;disabledStates&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;selectedUp&quot;</span> stateGroups=<span style="color: #ff0000;">&quot;selectedStates, selectedUpStates&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;selectedOver&quot;</span> stateGroups=<span style="color: #ff0000;">&quot;overStates, selectedStates&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;selectedDown&quot;</span> stateGroups=<span style="color: #ff0000;">&quot;downStates, selectedStates&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;selectedDisabled&quot;</span> stateGroups=<span style="color: #ff0000;">&quot;selectedUpStates, disabledStates, selectedStates&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:states</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- layer 1: shadow --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;0&quot;</span> right=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<span style="color: #ff0000;">&quot;-1&quot;</span> height=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> color=<span style="color: #ff0000;">&quot;black&quot;</span> </span>
<span style="color: #000000;">                    color.downStates=<span style="color: #ff0000;">&quot;white&quot;</span> </span>
<span style="color: #000000;">                    alpha=<span style="color: #ff0000;">&quot;0.07&quot;</span></span>
<span style="color: #000000;">                    alpha.downStates=<span style="color: #ff0000;">&quot;0.5&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- layer 2: fill --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;1&quot;</span> right=<span style="color: #ff0000;">&quot;1&quot;</span> top=<span style="color: #ff0000;">&quot;1&quot;</span> bottom=<span style="color: #ff0000;">&quot;1&quot;</span> alpha=<span style="color: #ff0000;">&quot;0.6&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BitmapFill</span> source=<span style="color: #ff0000;">&quot;@Embed('assets/pattern_149.gif')&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- layer 3: fill lowlight --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;1&quot;</span> right=<span style="color: #ff0000;">&quot;1&quot;</span> bottom=<span style="color: #ff0000;">&quot;1&quot;</span> height=<span style="color: #ff0000;">&quot;9&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:LinearGradient</span> rotation=<span style="color: #ff0000;">&quot;90&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;black&quot;</span> alpha=<span style="color: #ff0000;">&quot;0.0099&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;black&quot;</span> alpha=<span style="color: #ff0000;">&quot;0.0627&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:LinearGradient</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- layer 4: fill highlight --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;1&quot;</span> right=<span style="color: #ff0000;">&quot;1&quot;</span> top=<span style="color: #ff0000;">&quot;1&quot;</span> height=<span style="color: #ff0000;">&quot;9&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> color=<span style="color: #ff0000;">&quot;white&quot;</span> </span>
<span style="color: #000000;">                    alpha=<span style="color: #ff0000;">&quot;0.33&quot;</span> </span>
<span style="color: #000000;">                    alpha.selectedUpStates=<span style="color: #ff0000;">&quot;0.22&quot;</span></span>
<span style="color: #000000;">                    alpha.overStates=<span style="color: #ff0000;">&quot;0.22&quot;</span> </span>
<span style="color: #000000;">                    alpha.downStates=<span style="color: #ff0000;">&quot;0.12&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- layer 5: highlight stroke (all states except down) --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;1&quot;</span> right=<span style="color: #ff0000;">&quot;1&quot;</span> top=<span style="color: #ff0000;">&quot;1&quot;</span> bottom=<span style="color: #ff0000;">&quot;1&quot;</span> excludeFrom=<span style="color: #ff0000;">&quot;downStates&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:stroke</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:LinearGradientStroke</span> rotation=<span style="color: #ff0000;">&quot;90&quot;</span> weight=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;white&quot;</span> alpha.overStates=<span style="color: #ff0000;">&quot;0.22&quot;</span> alpha.selectedUpStates=<span style="color: #ff0000;">&quot;0.33&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;0xD8D8D8&quot;</span> alpha.overStates=<span style="color: #ff0000;">&quot;0.22&quot;</span> alpha.selectedUpStates=<span style="color: #ff0000;">&quot;0.33&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:LinearGradientStroke</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:stroke</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- layer 6: highlight stroke (down state only) --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;1&quot;</span> top=<span style="color: #ff0000;">&quot;1&quot;</span> bottom=<span style="color: #ff0000;">&quot;1&quot;</span> width=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #000000;">            includeIn=<span style="color: #ff0000;">&quot;downStates, selectedUpStates, selectedOver&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> color=<span style="color: #ff0000;">&quot;black&quot;</span> alpha=<span style="color: #ff0000;">&quot;0.07&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> right=<span style="color: #ff0000;">&quot;1&quot;</span> top=<span style="color: #ff0000;">&quot;1&quot;</span> bottom=<span style="color: #ff0000;">&quot;1&quot;</span> width=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #000000;">            includeIn=<span style="color: #ff0000;">&quot;downStates, selectedUpStates, selectedOver&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> color=<span style="color: #ff0000;">&quot;black&quot;</span> alpha=<span style="color: #ff0000;">&quot;0.07&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;1&quot;</span> top=<span style="color: #ff0000;">&quot;1&quot;</span> right=<span style="color: #ff0000;">&quot;1&quot;</span> height=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #000000;">            includeIn=<span style="color: #ff0000;">&quot;downStates, selectedUpStates, selectedOver&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> color=<span style="color: #ff0000;">&quot;black&quot;</span> alpha=<span style="color: #ff0000;">&quot;0.25&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;1&quot;</span> top=<span style="color: #ff0000;">&quot;2&quot;</span> right=<span style="color: #ff0000;">&quot;1&quot;</span> height=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #000000;">            includeIn=<span style="color: #ff0000;">&quot;downStates, selectedUpStates, selectedOver&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> color=<span style="color: #ff0000;">&quot;black&quot;</span> alpha=<span style="color: #ff0000;">&quot;0.09&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- layer 7: border - put on top of the fill so it doesn't disappear when scale is less than 1 --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;0&quot;</span> right=<span style="color: #ff0000;">&quot;0&quot;</span> top=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<span style="color: #ff0000;">&quot;0&quot;</span> width=<span style="color: #ff0000;">&quot;69&quot;</span> height=<span style="color: #ff0000;">&quot;20&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:stroke</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:LinearGradientStroke</span> rotation=<span style="color: #ff0000;">&quot;90&quot;</span> weight=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;black&quot;</span> </span>
<span style="color: #000000;">                        alpha=<span style="color: #ff0000;">&quot;0.5625&quot;</span></span>
<span style="color: #000000;">                        alpha.down=<span style="color: #ff0000;">&quot;0.6375&quot;</span></span>
<span style="color: #000000;">                        alpha.selectedStates=<span style="color: #ff0000;">&quot;0.6375&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;black&quot;</span> </span>
<span style="color: #000000;">                        alpha=<span style="color: #ff0000;">&quot;0.75&quot;</span> </span>
<span style="color: #000000;">                        alpha.down=<span style="color: #ff0000;">&quot;0.85&quot;</span></span>
<span style="color: #000000;">                        alpha.selectedStates=<span style="color: #ff0000;">&quot;0.85&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:LinearGradientStroke</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:stroke</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:SparkSkin</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<div span="googleAdsLeaderboard">
<script type="text/javascript"><!--
google_ad_client = "pub-3325829455487492";
/* 728x90, created 7/15/09 */
google_ad_slot = "6403511741";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br />
</div>
<p>You can also set the <code>buttonStyleName</code> style in an external .CSS file or &lt;Style/&gt; block, as seen in the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/07/09/setting-an-image-background-on-a-halo-buttonbar-control-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Halo_ButtonBar_buttonStyleName_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        @namespace s &quot;library://ns.adobe.com/flex/spark&quot;;
        @namespace mx &quot;library://ns.adobe.com/flex/halo&quot;;
&nbsp;
        mx|ButtonBar {
            buttonStyleName: buttonBarButtonStyles;
            firstButtonStyleName: buttonBarButtonStyles;
            lastButtonStyleName: buttonBarButtonStyles;
        }
&nbsp;
        .buttonBarButtonStyles {
            skin: ClassReference(&quot;skins.CustomButtonBarButtonSkin&quot;);
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ButtonBar</span> id=<span style="color: #ff0000;">&quot;btnBar&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;[The,Quick,Brown,Fox,Jumps,Over,The,Lazy,Dog]&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Or, you can set the <code>buttonStyleName</code> style using ActionScript, as seen in the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/07/09/setting-an-image-background-on-a-halo-buttonbar-control-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Halo_ButtonBar_buttonStyleName_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span></span>
<span style="color: #000000;">        initialize=<span style="color: #ff0000;">&quot;init();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            import skins.CustomButtonBarButtonSkin;</span>
&nbsp;
<span style="color: #000000;">            private function init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var buttonBarButtonStyles:CSSStyleDeclaration = new CSSStyleDeclaration<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;.buttonBarButtonStyles&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                buttonBarButtonStyles.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;skin&quot;</span>, CustomButtonBarButtonSkin<span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                var buttonBarStyles:CSSStyleDeclaration = StyleManager.getStyleDeclaration<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;mx.controls.ButtonBar&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                buttonBarStyles.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;buttonStyleName&quot;</span>, <span style="color: #ff0000;">&quot;buttonBarButtonStyles&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                buttonBarStyles.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;firstButtonStyleName&quot;</span>, <span style="color: #ff0000;">&quot;buttonBarButtonStyles&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                buttonBarStyles.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;lastButtonStyleName&quot;</span>, <span style="color: #ff0000;">&quot;buttonBarButtonStyles&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ButtonBar</span> id=<span style="color: #ff0000;">&quot;btnBar&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;[The,Quick,Brown,Fox,Jumps,Over,The,Lazy,Dog]&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/07/09/setting-an-image-background-on-a-halo-buttonbar-control-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Halo_ButtonBar_buttonStyleName_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span></span>
<span style="color: #000000;">        initialize=<span style="color: #ff0000;">&quot;init();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            import skins.CustomButtonBarButtonSkin;</span>
<span style="color: #000000;">            import mx.controls.ButtonBar;</span>
&nbsp;
<span style="color: #000000;">            private var btnBar:ButtonBar;</span>
&nbsp;
<span style="color: #000000;">            private function init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var buttonBarButtonStyles:CSSStyleDeclaration = new CSSStyleDeclaration<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;.buttonBarButtonStyles&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                buttonBarButtonStyles.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;skin&quot;</span>, CustomButtonBarButtonSkin<span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                btnBar = new ButtonBar<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                btnBar.dataProvider = <span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;The&quot;</span>, <span style="color: #ff0000;">&quot;Quick&quot;</span>, <span style="color: #ff0000;">&quot;Brown&quot;</span>, <span style="color: #ff0000;">&quot;Fox&quot;</span>, <span style="color: #ff0000;">&quot;Jumps&quot;</span>, <span style="color: #ff0000;">&quot;Over&quot;</span>, <span style="color: #ff0000;">&quot;The&quot;</span>, <span style="color: #ff0000;">&quot;Lazy&quot;</span>, <span style="color: #ff0000;">&quot;Dog&quot;</span><span style="color: #66cc66;">&#93;</span>;</span>
<span style="color: #000000;">                btnBar.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;buttonStyleName&quot;</span>, <span style="color: #ff0000;">&quot;buttonBarButtonStyles&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                btnBar.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;firstButtonStyleName&quot;</span>, <span style="color: #ff0000;">&quot;buttonBarButtonStyles&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                btnBar.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;lastButtonStyleName&quot;</span>, <span style="color: #ff0000;">&quot;buttonBarButtonStyles&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                btnBar.horizontalCenter = <span style="color: #cc66cc;">0</span>;</span>
<span style="color: #000000;">                btnBar.verticalCenter = <span style="color: #cc66cc;">0</span>;</span>
<span style="color: #000000;">                addElement<span style="color: #66cc66;">&#40;</span>btnBar<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting an image background on a Halo ButtonBar control in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/07/09/setting-an-image-background-on-a-halo-buttonbar-control-in-flex-4/',contentID: 'post-1474',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'buttonStyleName,firstButtonStyleName,Gumbo,lastButtonStyleName,skin',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/07/09/setting-an-image-background-on-a-halo-buttonbar-control-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling the last button in a ButtonBar control in Flex</title>
		<link>http://blog.flexexamples.com/2009/01/28/styling-the-last-button-in-a-buttonbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2009/01/28/styling-the-last-button-in-a-buttonbar-control-in-flex/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 07:54:15 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ButtonBar]]></category>
		<category><![CDATA[lastButtonStyleName]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/28/styling-the-last-button-in-a-buttonbar-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can style the last button in a Flex ButtonBar control by setting the lastButtonStyleName style.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2009/01/28/styling-the-last-button-in-a-buttonbar-control-in-flex/ --&#62; &#60;mx:Application name="ButtonBar_lastButtonStyleName_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; .lastButton { color: red; cornerRadius: 10; fontWeight: normal; themeColor: haloGreen; } [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can style the last button in a Flex ButtonBar control by setting the <code>lastButtonStyleName</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-946"></span></p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/01/28/styling-the-last-button-in-a-buttonbar-control-in-flex/ --&gt;
&lt;mx:Application name="ButtonBar_lastButtonStyleName_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        .lastButton {
            color: red;
            cornerRadius: 10;
            fontWeight: normal;
            themeColor: haloGreen;
        }
    &lt;/mx:Style&gt;

    &lt;mx:ButtonBar id="buttonBar"
            dataProvider="[Red,Orange,Yellow,Green,Blue]"
            lastButtonStyleName="lastButton" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>You can also set the <code>lastButtonStyleName</code> style in an external .CSS file or &lt;Style&gt; block, as seen in the following example:</p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/01/28/styling-the-last-button-in-a-buttonbar-control-in-flex/ --&gt;
&lt;mx:Application name="ButtonBar_lastButtonStyleName_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        .lastButton {
            color: red;
            cornerRadius: 10;
            fontWeight: normal;
            themeColor: haloGreen;
        }

        ButtonBar {
            lastButtonStyleName: lastButton;
        }
    &lt;/mx:Style&gt;

    &lt;mx:ButtonBar id="buttonBar"
            dataProvider="[Red,Orange,Yellow,Green,Blue]" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>lastButtonStyleName</code> style using ActionScript, as seen in the following example:</p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/01/28/styling-the-last-button-in-a-buttonbar-control-in-flex/ --&gt;
&lt;mx:Application name="ButtonBar_lastButtonStyleName_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function init():void {
                buttonBar.setStyle("lastButtonStyleName", "lastButton");
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Style&gt;
        .lastButton {
            color: red;
            cornerRadius: 10;
            fontWeight: normal;
            themeColor: haloGreen;
        }
    &lt;/mx:Style&gt;

    &lt;mx:ButtonBar id="buttonBar"
            dataProvider="[Red,Orange,Yellow,Green,Blue]"
            initialize="init();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/01/28/styling-the-last-button-in-a-buttonbar-control-in-flex/ --&gt;
&lt;mx:Application name="ButtonBar_lastButtonStyleName_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.ButtonBar;

            private var arr:Array;
            private var lastButtonStyle:CSSStyleDeclaration;
            private var buttonBar:ButtonBar;

            private function init():void {
                arr = [];
                arr.push("Red");
                arr.push("Orange");
                arr.push("Yellow");
                arr.push("Green");
                arr.push("Blue");

                lastButtonStyle = new CSSStyleDeclaration(".lastButton");
                lastButtonStyle.setStyle("color", "red");
                lastButtonStyle.setStyle("cornerRadius", 10);
                lastButtonStyle.setStyle("fontWeight", "normal");
                lastButtonStyle.setStyle("themeColor", "haloGreen");

                buttonBar = new ButtonBar();
                buttonBar.dataProvider = arr;
                buttonBar.setStyle("lastButtonStyleName", "lastButton");
                addChild(buttonBar);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Styling the last button in a ButtonBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/01/28/styling-the-last-button-in-a-buttonbar-control-in-flex/',contentID: 'post-946',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'lastButtonStyleName',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/01/28/styling-the-last-button-in-a-buttonbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting the button height on a ButtonBar control in Flex</title>
		<link>http://blog.flexexamples.com/2008/09/30/setting-the-button-height-on-a-buttonbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/09/30/setting-the-button-height-on-a-buttonbar-control-in-flex/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 06:39:16 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ButtonBar]]></category>
		<category><![CDATA[buttonHeight]]></category>
		<category><![CDATA[direction]]></category>
		<category><![CDATA[textAlign]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/30/setting-the-button-height-on-a-buttonbar-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the button height on a Flex ButtonBar control by setting the buttonHeight style.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonHeight_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/09/30/setting-the-button-height-on-a-buttonbar-control-in-flex/ --&#62; &#60;mx:Application name="ButtonBar_buttonHeight_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; .buttonBarButtonStyles { textAlign: left; } &#60;/mx:Style&#62; &#60;mx:Array id="arr"&#62; &#60;mx:Object label="Red" icon="@Embed('assets/bullet_red.png')" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the button height on a Flex ButtonBar control by setting the <code>buttonHeight</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-813"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonHeight_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/30/setting-the-button-height-on-a-buttonbar-control-in-flex/ --&gt;
&lt;mx:Application name="ButtonBar_buttonHeight_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        .buttonBarButtonStyles {
            textAlign: left;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Red"
                icon="@Embed('assets/bullet_red.png')" /&gt;
        &lt;mx:Object label="Orange"
                icon="@Embed('assets/bullet_orange.png')" /&gt;
        &lt;mx:Object label="Yellow"
                icon="@Embed('assets/bullet_yellow.png')" /&gt;
        &lt;mx:Object label="Green"
                icon="@Embed('assets/bullet_green.png')" /&gt;
        &lt;mx:Object label="Blue"
                icon="@Embed('assets/bullet_blue.png')" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="buttonHeight:"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="16"
                        maximum="48"
                        value="24"
                        snapInterval="1"
                        tickInterval="2"
                        liveDragging="true" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="direction:"&gt;
                &lt;mx:ComboBox id="comboBox"
                        dataProvider="[horizontal,vertical]" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:ButtonBar id="buttonBar"
            dataProvider="{arr}"
            buttonHeight="{slider.value}"
            direction="{comboBox.selectedItem}"
            buttonStyleName="buttonBarButtonStyles" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonHeight_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonHeight_test/bin/main.html" width="100%" height="360"></iframe></p>
<p>You can also set the <code>buttonHeight</code> style in an external .CSS file or &lt;mx:Style /&gt; block, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonHeight_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/30/setting-the-button-height-on-a-buttonbar-control-in-flex/ --&gt;
&lt;mx:Application name="ButtonBar_buttonHeight_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        ButtonBar {
            buttonHeight: 16;
            buttonStyleName: buttonBarButtonStyles;
        }

        .buttonBarButtonStyles {
            textAlign: left;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Red"
                icon="@Embed('assets/bullet_red.png')" /&gt;
        &lt;mx:Object label="Orange"
                icon="@Embed('assets/bullet_orange.png')" /&gt;
        &lt;mx:Object label="Yellow"
                icon="@Embed('assets/bullet_yellow.png')" /&gt;
        &lt;mx:Object label="Green"
                icon="@Embed('assets/bullet_green.png')" /&gt;
        &lt;mx:Object label="Blue"
                icon="@Embed('assets/bullet_blue.png')" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="direction:"&gt;
                &lt;mx:ComboBox id="comboBox"
                        dataProvider="[horizontal,vertical]" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:ButtonBar id="buttonBar"
            dataProvider="{arr}"
            direction="{comboBox.selectedItem}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>buttonHeight</code> style using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonHeight_test/bin/srcview/source/main3.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/30/setting-the-button-height-on-a-buttonbar-control-in-flex/ --&gt;
&lt;mx:Application name="ButtonBar_buttonHeight_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        ButtonBar {
            buttonHeight: 24;
            buttonStyleName: buttonBarButtonStyles;
        }

        .buttonBarButtonStyles {
            textAlign: left;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.ListEvent;
            import mx.events.SliderEvent;

            private function slider_change(evt:SliderEvent):void {
                buttonBar.setStyle("buttonHeight", evt.value);
            }

            private function comboBox_change(evt:ListEvent):void {
                buttonBar.direction = comboBox.selectedItem.toString();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Red"
                icon="@Embed('assets/bullet_red.png')" /&gt;
        &lt;mx:Object label="Orange"
                icon="@Embed('assets/bullet_orange.png')" /&gt;
        &lt;mx:Object label="Yellow"
                icon="@Embed('assets/bullet_yellow.png')" /&gt;
        &lt;mx:Object label="Green"
                icon="@Embed('assets/bullet_green.png')" /&gt;
        &lt;mx:Object label="Blue"
                icon="@Embed('assets/bullet_blue.png')" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="buttonHeight:"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="16"
                        maximum="48"
                        value="24"
                        snapInterval="1"
                        tickInterval="2"
                        liveDragging="true"
                        change="slider_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="direction:"&gt;
                &lt;mx:ComboBox id="comboBox"
                        dataProvider="[horizontal,vertical]"
                        change="comboBox_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:ButtonBar id="buttonBar"
            dataProvider="{arr}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonHeight_test/bin/srcview/source/main4.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/30/setting-the-button-height-on-a-buttonbar-control-in-flex/ --&gt;
&lt;mx:Application name="ButtonBar_buttonHeight_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.containers.ApplicationControlBar;
            import mx.containers.BoxDirection;
            import mx.containers.Form;
            import mx.containers.FormItem;
            import mx.controls.ButtonBar;
            import mx.controls.ComboBox;
            import mx.controls.HSlider;
            import mx.events.ListEvent;
            import mx.events.SliderEvent;

            [Embed("assets/bullet_red.png")]
            private const BulletRedIcon:Class;

            [Embed("assets/bullet_orange.png")]
            private const BulletOrangeIcon:Class;

            [Embed("assets/bullet_yellow.png")]
            private const BulletYellowIcon:Class;

            [Embed("assets/bullet_green.png")]
            private const BulletGreenIcon:Class;

            [Embed("assets/bullet_blue.png")]
            private const BulletBlueIcon:Class;

            private var buttonBarButtonStyles:CSSStyleDeclaration;
            private var arr:Array;
            private var slider:HSlider;
            private var comboBox:ComboBox;
            private var buttonBar:ButtonBar;

            private function init():void {
                arr = [];
                arr.push({label:"Red", icon:BulletRedIcon});
                arr.push({label:"Orange", icon:BulletOrangeIcon});
                arr.push({label:"Yellow", icon:BulletYellowIcon});
                arr.push({label:"Green", icon:BulletGreenIcon});
                arr.push({label:"Blue", icon:BulletBlueIcon});

                buttonBarButtonStyles = new CSSStyleDeclaration(".buttonBarButtonStyles");
                buttonBarButtonStyles.setStyle("textAlign", "left");

                slider = new HSlider();
                slider.minimum = 16;
                slider.maximum = 48;
                slider.value = 24;
                slider.snapInterval = 1;
                slider.tickInterval = 2;
                slider.liveDragging = true;
                slider.addEventListener(SliderEvent.CHANGE,
                            slider_change);

                comboBox = new ComboBox();
                comboBox.dataProvider = [BoxDirection.HORIZONTAL, BoxDirection.VERTICAL];
                comboBox.addEventListener(ListEvent.CHANGE,
                            comboBox_change);

                var formItem1:FormItem = new FormItem();
                formItem1.label = "buttonHeight:";
                formItem1.addChild(slider);

                var formItem2:FormItem = new FormItem();
                formItem2.label = "direction:";
                formItem2.addChild(comboBox);

                var form:Form = new Form();
                form.styleName = "plain";
                form.addChild(formItem1);
                form.addChild(formItem2);

                var appControlBar:ApplicationControlBar;
                appControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(form);
                addChildAt(appControlBar, 0);

                buttonBar = new ButtonBar();
                buttonBar.dataProvider = arr;
                buttonBar.setStyle("buttonHeight", 24);
                buttonBar.setStyle("buttonStyleName", "buttonBarButtonStyles");
                addChild(buttonBar);
            }

            private function slider_change(evt:SliderEvent):void {
                buttonBar.setStyle("buttonHeight", evt.value);
            }

            private function comboBox_change(evt:ListEvent):void {
                buttonBar.direction = comboBox.selectedItem.toString();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the button height on a ButtonBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/09/30/setting-the-button-height-on-a-buttonbar-control-in-flex/',contentID: 'post-813',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'buttonHeight,direction,textAlign',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/09/30/setting-the-button-height-on-a-buttonbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting a custom tool tip field on a ButtonBar control in Flex</title>
		<link>http://blog.flexexamples.com/2008/04/27/setting-a-custom-tool-tip-field-on-a-buttonbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/04/27/setting-a-custom-tool-tip-field-on-a-buttonbar-control-in-flex/#comments</comments>
		<pubDate>Sun, 27 Apr 2008 17:16:49 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ButtonBar]]></category>
		<category><![CDATA[iconField]]></category>
		<category><![CDATA[labelField]]></category>
		<category><![CDATA[toolTipField]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/04/27/setting-a-custom-tool-tip-field-on-a-buttonbar-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can specify a custom field to be used for a tool tip in a Flex ButtonBar control by setting the toolTipField property.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2008/04/27/setting-a-custom-tool-tip-field-on-a-buttonbar-control-in-flex/ --&#62; &#60;mx:Application name=&#34;ButtonBar_toolTipField_test&#34; xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; &#160; &#60;mx:Array id=&#34;arr&#34;&#62; &#60;mx:Object label=&#34;Accordion&#34; toolTip=&#34;Le Accordion&#34; icon=&#34;@Embed('assets/Accordion.png')&#34; /&#62; &#60;mx:Object label=&#34;ApplicationControlBar&#34; toolTip=&#34;Le ApplicationControlBar&#34; icon=&#34;@Embed('assets/ApplicationControlBar.png')&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can specify a custom field to be used for a tool tip in a Flex ButtonBar control by setting the <code>toolTipField</code> property.</p>
<p><span id="more-610"></span></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2008/04/27/setting-a-custom-tool-tip-field-on-a-buttonbar-control-in-flex/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;ButtonBar_toolTipField_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Array</span> id=<span style="color: #ff0000;">&quot;arr&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;Accordion&quot;</span></span>
<span style="color: #000000;">                toolTip=<span style="color: #ff0000;">&quot;Le Accordion&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('assets/Accordion.png')&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;ApplicationControlBar&quot;</span></span>
<span style="color: #000000;">                toolTip=<span style="color: #ff0000;">&quot;Le ApplicationControlBar&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('assets/ApplicationControlBar.png')&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;Box&quot;</span></span>
<span style="color: #000000;">                toolTip=<span style="color: #ff0000;">&quot;Le Box&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('assets/Box.png')&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;Canvas&quot;</span></span>
<span style="color: #000000;">                toolTip=<span style="color: #ff0000;">&quot;Le Canvas&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('assets/Canvas.png')&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;ControlBar&quot;</span></span>
<span style="color: #000000;">                toolTip=<span style="color: #ff0000;">&quot;Le ControlBar&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('assets/ControlBar.png')&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Array</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ButtonBar</span> id=<span style="color: #ff0000;">&quot;buttonBar&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;{arr}&quot;</span></span>
<span style="color: #000000;">            labelField=<span style="color: #ff0000;">&quot;label&quot;</span></span>
<span style="color: #000000;">            toolTipField=<span style="color: #ff0000;">&quot;toolTip&quot;</span></span>
<span style="color: #000000;">            iconField=<span style="color: #ff0000;">&quot;icon&quot;</span></span>
<span style="color: #000000;">            height=<span style="color: #ff0000;">&quot;32&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_toolTipField_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_toolTipField_test/bin/main.html" width="100%" height="100"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a custom tool tip field on a ButtonBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/04/27/setting-a-custom-tool-tip-field-on-a-buttonbar-control-in-flex/',contentID: 'post-610',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'iconField,labelField,toolTipField',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/04/27/setting-a-custom-tool-tip-field-on-a-buttonbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Setting the data provider of a Flex ButtonBar control to a ViewStack container</title>
		<link>http://blog.flexexamples.com/2008/01/11/setting-the-data-provider-of-a-flex-buttonbar-control-to-a-viewstack-container/</link>
		<comments>http://blog.flexexamples.com/2008/01/11/setting-the-data-provider-of-a-flex-buttonbar-control-to-a-viewstack-container/#comments</comments>
		<pubDate>Fri, 11 Jan 2008 09:49:18 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ButtonBar]]></category>
		<category><![CDATA[ViewStack]]></category>
		<category><![CDATA[dataProvider]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/11/setting-the-data-provider-of-a-flex-buttonbar-control-to-a-viewstack-container/</guid>
		<description><![CDATA[<p>The following example shows how you can set the data provider of a ButtonBar control in Flex to a ViewStack container.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_dataProvider_ViewStack_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/01/11/setting-the-data-provider-of-a-flex-buttonbar-control-to-a-viewstack-container/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:ButtonBar id="buttonBar" dataProvider="{viewStack}" buttonHeight="32" /&#62; &#60;mx:ViewStack id="viewStack"&#62; &#60;mx:VBox label="Button" icon="@Embed('assets/Button.png')" backgroundColor="white" width="480" height="60"&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the data provider of a ButtonBar control in Flex to a ViewStack container.</p>
<p>Full code after the jump.</p>
<p><span id="more-435"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_dataProvider_ViewStack_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/01/11/setting-the-data-provider-of-a-flex-buttonbar-control-to-a-viewstack-container/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:ButtonBar id="buttonBar"
            dataProvider="{viewStack}"
            buttonHeight="32" /&gt;

    &lt;mx:ViewStack id="viewStack"&gt;
        &lt;mx:VBox label="Button"
                icon="@Embed('assets/Button.png')"
                backgroundColor="white"
                width="480"
                height="60"&gt;
            &lt;mx:Label text="Button..." /&gt;
        &lt;/mx:VBox&gt;
        &lt;mx:VBox label="ButtonBar"
                icon="@Embed('assets/ButtonBar.png')"
                backgroundColor="white"
                width="480"
                height="60"&gt;
            &lt;mx:Label text="ButtonBar..." /&gt;
        &lt;/mx:VBox&gt;
        &lt;mx:VBox label="CheckBox"
                icon="@Embed('assets/CheckBox.png')"
                backgroundColor="white"
                width="480"
                height="60"&gt;
            &lt;mx:Label text="CheckBox..." /&gt;
        &lt;/mx:VBox&gt;
        &lt;mx:VBox label="ColorPicker"
            icon="@Embed('assets/ColorPicker.png')"
                backgroundColor="white"
                width="480"
                height="60"&gt;
            &lt;mx:Label text="ColorPicker..." /&gt;
        &lt;/mx:VBox&gt;
    &lt;/mx:ViewStack&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_dataProvider_ViewStack_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_dataProvider_ViewStack_test/bin/main.html" width="100%" height="150"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the data provider of a Flex ButtonBar control to a ViewStack container on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/11/setting-the-data-provider-of-a-flex-buttonbar-control-to-a-viewstack-container/',contentID: 'post-435',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'dataProvider',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/01/11/setting-the-data-provider-of-a-flex-buttonbar-control-to-a-viewstack-container/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Disabling individual buttons on a Flex ButtonBar control</title>
		<link>http://blog.flexexamples.com/2008/01/10/disabling-individual-buttons-on-a-flex-buttonbar-control/</link>
		<comments>http://blog.flexexamples.com/2008/01/10/disabling-individual-buttons-on-a-flex-buttonbar-control/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 09:19:43 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ButtonBar]]></category>
		<category><![CDATA[enabled]]></category>
		<category><![CDATA[getChildAt()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/10/disabling-individual-buttons-on-a-flex-buttonbar-control/</guid>
		<description><![CDATA[<p>The following example shows how you can disable individual buttons on a ButtonBar control in Flex by using the getChildAt() method and enabled property on the returned button instance.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2008/01/10/disabling-individual-buttons-on-a-flex-buttonbar-control/ --&#62; &#60;mx:Application xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; &#160; &#60;mx:Style&#62; ButtonBar { buttonStyleName: myCustomButtonStyleName; } &#160; .myCustomButtonStyleName [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can disable individual buttons on a ButtonBar control in Flex by using the <code>getChildAt()</code> method and <code>enabled</code> property on the returned button instance.</p>
<p>Full code after the jump.</p>
<p><span id="more-438"></span></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2008/01/10/disabling-individual-buttons-on-a-flex-buttonbar-control/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        ButtonBar {
            buttonStyleName: myCustomButtonStyleName;
        }
&nbsp;
        .myCustomButtonStyleName {
            cornerRadius: 0;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.controls.buttonBarClasses.ButtonBarButton;</span>
&nbsp;
<span style="color: #339933;">            private function toggleButton(idx:uint, selected:Boolean):void {</span>
<span style="color: #339933;">                var b3:ButtonBarButton = buttonBar.getChildAt(idx) as ButtonBarButton;</span>
<span style="color: #339933;">                b3.enabled = selected;</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Array</span> id=<span style="color: #ff0000;">&quot;arr&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;Button&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;ButtonBar&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;ColorPicker&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;ComboBox&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Array</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ApplicationControlBar</span> dock=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Form</span> styleName=<span style="color: #ff0000;">&quot;plain&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;Button enabled:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:CheckBox</span> id=<span style="color: #ff0000;">&quot;ch1&quot;</span></span>
<span style="color: #000000;">                        selected=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                        click=<span style="color: #ff0000;">&quot;toggleButton(0, ch1.selected);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;ButtonBar enabled:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:CheckBox</span> id=<span style="color: #ff0000;">&quot;ch2&quot;</span></span>
<span style="color: #000000;">                        selected=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                        click=<span style="color: #ff0000;">&quot;toggleButton(1, ch2.selected);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;ColorPicker enabled:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:CheckBox</span> id=<span style="color: #ff0000;">&quot;ch3&quot;</span></span>
<span style="color: #000000;">                        selected=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                        click=<span style="color: #ff0000;">&quot;toggleButton(2, ch3.selected);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;ComboBox enabled:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:CheckBox</span> id=<span style="color: #ff0000;">&quot;ch4&quot;</span></span>
<span style="color: #000000;">                        selected=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                        click=<span style="color: #ff0000;">&quot;toggleButton(3, ch4.selected);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ApplicationControlBar</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ButtonBar</span> id=<span style="color: #ff0000;">&quot;buttonBar&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;{arr}&quot;</span></span>
<span style="color: #000000;">            itemClick=<span style="color: #ff0000;">&quot;lbl.text = event.label;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> id=<span style="color: #ff0000;">&quot;lbl&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_getChildAt_enabled_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_getChildAt_enabled_test/bin/main.html" width="100%" height="250"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Disabling individual buttons on a Flex ButtonBar control on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/10/disabling-individual-buttons-on-a-flex-buttonbar-control/',contentID: 'post-438',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'enabled,getChildAt()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/01/10/disabling-individual-buttons-on-a-flex-buttonbar-control/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Setting skins on the the Flex ButtonBar control</title>
		<link>http://blog.flexexamples.com/2008/01/10/setting-skins-on-the-the-flex-buttonbar-control/</link>
		<comments>http://blog.flexexamples.com/2008/01/10/setting-skins-on-the-the-flex-buttonbar-control/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 08:08:19 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ButtonBar]]></category>
		<category><![CDATA[buttonHeight]]></category>
		<category><![CDATA[buttonStyleName]]></category>
		<category><![CDATA[disabledSkin]]></category>
		<category><![CDATA[downSkin]]></category>
		<category><![CDATA[overSkin]]></category>
		<category><![CDATA[skin]]></category>
		<category><![CDATA[upSkin]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/10/setting-skins-on-the-the-flex-buttonbar-control/</guid>
		<description><![CDATA[<p>The following example shows how you can skin the ButtonBar control in Flex by setting the buttonStyleName style and setting one or more of the following skin styles: skin, upSkin, overSkin, downSkin, disabledSkin.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2008/01/10/setting-skins-on-the-the-flex-buttonbar-control/ --&#62; &#60;mx:Application name=&#34;ButtonBar_buttonStyleName_skin_test &#34; xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; &#160; &#60;mx:Style&#62; ButtonBar [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can skin the ButtonBar control in Flex by setting the <code>buttonStyleName</code> style and setting one or more of the following skin styles: <code>skin</code>, <code>upSkin</code>, <code>overSkin</code>, <code>downSkin</code>, <code>disabledSkin</code>.</p>
<p>Full code after the jump.</p>
<p><span id="more-437"></span></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2008/01/10/setting-skins-on-the-the-flex-buttonbar-control/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;ButtonBar_buttonStyleName_skin_test &quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        ButtonBar {
            buttonStyleName: myCustomButtonStyleName;
            color: #999999;
        }
&nbsp;
        .myCustomButtonStyleName {
            skin: Embed(source=&quot;assets/ButtonBarSkins.swf&quot;,
                        symbol=&quot;ButtonBarButton_skin&quot;);
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.events.SliderEvent;</span>
&nbsp;
<span style="color: #339933;">            private function slider_change(evt:SliderEvent):void {</span>
<span style="color: #339933;">                buttonBar.setStyle(&quot;buttonHeight&quot;, evt.value);</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Array</span> id=<span style="color: #ff0000;">&quot;arr&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;Button&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;ButtonBar&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;ColorPicker&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;ComboBox&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Array</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ApplicationControlBar</span> dock=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Form</span> styleName=<span style="color: #ff0000;">&quot;plain&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;buttonHeight:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:HSlider</span> id=<span style="color: #ff0000;">&quot;slider&quot;</span></span>
<span style="color: #000000;">                        minimum=<span style="color: #ff0000;">&quot;24&quot;</span></span>
<span style="color: #000000;">                        maximum=<span style="color: #ff0000;">&quot;64&quot;</span></span>
<span style="color: #000000;">                        snapInterval=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #000000;">                        tickInterval=<span style="color: #ff0000;">&quot;4&quot;</span></span>
<span style="color: #000000;">                        liveDragging=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                        change=<span style="color: #ff0000;">&quot;slider_change(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ApplicationControlBar</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ButtonBar</span> id=<span style="color: #ff0000;">&quot;buttonBar&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;{arr}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonStyleName_skin_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonStyleName_skin_test/bin/main.html" width="100%" height="150"></iframe></p>
<p>For simplicity sake, I only set the generic &#8220;skin&#8221; style which applies to all states (up, over, down, and disabled). You will also notice that we embedded a skin from a SWF file and the skins various scale grid settings (<code>scaleGridTop</code>, <code>scaleGridBottom</code>, <code>scaleGridLeft</code>, and <code>scaleGridRight</code>) are set in the FLA/SWF file and not in the MXML file itself. This allows you to resize the ButtonBar control without distorting the 2 pixel border on the bottom of the skin.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting skins on the the Flex ButtonBar control on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/10/setting-skins-on-the-the-flex-buttonbar-control/',contentID: 'post-437',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'buttonHeight,buttonStyleName,disabledSkin,downSkin,overSkin,skin,upSkin',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/01/10/setting-skins-on-the-the-flex-buttonbar-control/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Creating a custom label function on a Flex ButtonBar control</title>
		<link>http://blog.flexexamples.com/2008/01/09/creating-a-custom-label-function-on-a-flex-buttonbar-control/</link>
		<comments>http://blog.flexexamples.com/2008/01/09/creating-a-custom-label-function-on-a-flex-buttonbar-control/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 07:24:16 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ButtonBar]]></category>
		<category><![CDATA[describeType()]]></category>
		<category><![CDATA[labelFunction]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/09/creating-a-custom-label-function-on-a-flex-buttonbar-control/</guid>
		<description><![CDATA[<p>The following example shows how you can use a custom label function to create button labels on a ButtonBar control in Flex by setting the labelFunction property.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_labelFunction_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/01/09/creating-a-custom-label-function-on-a-flex-buttonbar-control/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.controls.ButtonBar; private var buttonBarXML:XML [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can use a custom label function to create button labels on a ButtonBar control in Flex by setting the <code>labelFunction</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-436"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_labelFunction_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/01/09/creating-a-custom-label-function-on-a-flex-buttonbar-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.ButtonBar;

            private var buttonBarXML:XML = describeType(ButtonBar);

            private function buttonBar_labelFunc(item:Object):String {
                var cat:String = item.category.toUpperCase();
                var len:uint = buttonBarXML.factory.child(item.data).length();
                return cat + " (" + len + ")";
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object category="Accessors" data="accessor" /&gt;
        &lt;mx:Object category="Methods" data="method" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ButtonBar id="buttonBar"
            dataProvider="{arr}"
            labelFunction="buttonBar_labelFunc" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_labelFunction_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_labelFunction_test/bin/main.html" width="100%" height="100"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Creating a custom label function on a Flex ButtonBar control on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/09/creating-a-custom-label-function-on-a-flex-buttonbar-control/',contentID: 'post-436',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'describeType(),labelFunction',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/01/09/creating-a-custom-label-function-on-a-flex-buttonbar-control/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Determining which button was pressed in a Flex ButtonBar component</title>
		<link>http://blog.flexexamples.com/2008/01/09/determining-which-button-was-pressed-in-a-flex-buttonbar-component/</link>
		<comments>http://blog.flexexamples.com/2008/01/09/determining-which-button-was-pressed-in-a-flex-buttonbar-component/#comments</comments>
		<pubDate>Wed, 09 Jan 2008 08:46:53 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ButtonBar]]></category>
		<category><![CDATA[ItemClickEvent]]></category>
		<category><![CDATA[Label]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[item]]></category>
		<category><![CDATA[itemClick]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/09/determining-which-button-was-pressed-in-a-flex-buttonbar-component/</guid>
		<description><![CDATA[<p>The following example shows how you can determine which button was pressed in a ButtonBar control in Flex by listening for the itemClick event. You can then use the item, index, or label attribute in the ItemClickEvent object to find out which button was clicked.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_itemClick_test/main.mxml">View MXML</a></p> [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can determine which button was pressed in a ButtonBar control in Flex by listening for the <code>itemClick</code> event. You can then use the <code>item</code>, <code>index</code>, or <code>label</code> attribute in the ItemClickEvent object to find out which button was clicked.</p>
<p>Full code after the jump.</p>
<p><span id="more-434"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_itemClick_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/01/09/determining-which-button-was-pressed-in-a-flex-buttonbar-component/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;
            import mx.controls.buttonBarClasses.ButtonBarButton;
            import mx.events.ItemClickEvent;
            import mx.utils.ObjectUtil;

            private function buttonBar_itemClick(evt:ItemClickEvent):void {
                var message:String = ObjectUtil.toString(evt.item);
                var title:String = "[" + evt.index + "] " + evt.label;
                Alert.show("item: " + message, title);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="One" data="15" /&gt;
        &lt;mx:Object label="Two" data="12" custom="seven" /&gt;
        &lt;mx:Object label="Three" data="9" /&gt;
        &lt;mx:Object label="Four" custom="eleven" /&gt;
        &lt;mx:Object label="Five" name="Peter" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ButtonBar id="buttonBar"
            dataProvider="{arr}"
            itemClick="buttonBar_itemClick(event);" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_itemClick_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_itemClick_test/bin/main.html" width="100%" height="250"></iframe></p>
<p>As you can see, you can use several different properties in the ItemClickEvent to determine which button was pressed:</p>
<ul>
<li>The <code>index</code> property is the zero-based index of the navigation item that was clicked.</li>
<li>The <code>label</code> property is the label of the navigation item that was clicked.</li>
<li>The <code>item</code> property is the item in the data provider of the navigation item that was clicked.</li>
</ul>
<p>The following example shows how you can create the previous example using ActionScript:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/01/09/determining-which-button-was-pressed-in-a-flex-buttonbar-component/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"
        creationComplete="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;
            import mx.controls.ButtonBar;
            import mx.controls.buttonBarClasses.ButtonBarButton;
            import mx.events.ItemClickEvent;
            import mx.utils.ObjectUtil;

            private var buttonBar:ButtonBar;
            private var arr:Array;

            private function init():void {
                arr = [];
                arr.push({label:"One", data:15});
                arr.push({label:"Two", data:12, custom:"seven"});
                arr.push({label:"Three", data:9});
                arr.push({label:"Four", custom:"eleven"});
                arr.push({label:"Five", name:"Peter"});

                buttonBar = new ButtonBar();
                buttonBar.dataProvider = arr;
                buttonBar.addEventListener(ItemClickEvent.ITEM_CLICK, buttonBar_itemClick);
                addChild(buttonBar);
            }

            private function buttonBar_itemClick(evt:ItemClickEvent):void {
                var message:String = ObjectUtil.toString(evt.item);
                var title:String = "[" + evt.index + "] " + evt.label;
                Alert.show("item: " + message, title);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Determining which button was pressed in a Flex ButtonBar component on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/09/determining-which-button-was-pressed-in-a-flex-buttonbar-component/',contentID: 'post-434',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'index,item,itemClick',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/01/09/determining-which-button-was-pressed-in-a-flex-buttonbar-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

