<?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; TabBar</title>
	<atom:link href="http://blog.flexexamples.com/category/halo/tabbar/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 TabBar control in Flex</title>
		<link>http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-tabbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-tabbar-control-in-flex/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 02:41:44 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TabBar]]></category>
		<category><![CDATA[ClassFactory]]></category>
		<category><![CDATA[icon]]></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=3436</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/">&#8220;Changing the label placement on an MX ButtonBar control in Flex (redux)&#8221;</a>, we saw how you could set the label/icon placement on an MX ButtonBar control in Flex by extending the MX ButtonBar class and setting the navItemFactory property in the mx_internal namespace to a custom class.</p> <p>The following example [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/">&#8220;Changing the label placement on an MX ButtonBar control in Flex (redux)&#8221;</a>, we saw how you could 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>The following example shows how you can set the label/icon placement on an MX TabBar control in Flex by extending the MX TabBar class and setting the <code>navItemFactory</code> property in the  <code>mx_internal</code> namespace to a custom Tab button class.</p>
<p><span id="more-3436"></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-tabbar-control-in-flex/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;MX_TabBar_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:comps=<span style="color: #ff0000;">&quot;comps.*&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;comps:CustomTabBar</span> id=<span style="color: #ff0000;">&quot;tb&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 TabBar control, <em>comps/CustomTabBar.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-tabbar-control-in-flex/ */</span>
<span style="color: #9900cc; font-weight: bold;">package</span> comps <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>TabBar<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> CustomTabBar <span style="color: #0033ff; font-weight: bold;">extends</span> TabBar <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomTabBar<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>CustomTab<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>comps/CustomTab.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-tabbar-control-in-flex/ */</span>
<span style="color: #9900cc; font-weight: bold;">package</span> comps <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>tabBarClasses<span style="color: #000066; font-weight: bold;">.</span>Tab<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> CustomTab <span style="color: #0033ff; font-weight: bold;">extends</span> Tab <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomTab<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 TabBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-tabbar-control-in-flex/',contentID: 'post-3436',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'ClassFactory,icon,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-tabbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Setting the tab width on an MX TabNavigator container in Flex 3</title>
		<link>http://blog.flexexamples.com/2010/06/22/setting-the-tab-width-on-an-mx-tabnavigator-container-in-flex-3/</link>
		<comments>http://blog.flexexamples.com/2010/06/22/setting-the-tab-width-on-an-mx-tabnavigator-container-in-flex-3/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 20:05:12 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TabBar]]></category>
		<category><![CDATA[TabNavigator]]></category>
		<category><![CDATA[getTabAt()]]></category>
		<category><![CDATA[getTabBar()]]></category>
		<category><![CDATA[mx_internal]]></category>
		<category><![CDATA[tabWidth]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3185</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/10/04/setting-the-tab-width-on-a-tabbar-control-in-flex/">&#8220;Setting the tab width on a TabBar control in Flex&#8221;</a>, we saw how you could set the tab width on a Flex MX TabBar control by setting the aptly named tabWidth style.</p> <p>The following example shows how you can can set the tab width on an MX TabNavigator container in [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/10/04/setting-the-tab-width-on-a-tabbar-control-in-flex/">&#8220;Setting the tab width on a TabBar control in Flex&#8221;</a>, we saw how you could set the tab width on a Flex MX TabBar control by setting the aptly named <code>tabWidth</code> style.</p>
<p>The following example shows how you can can set the tab width on an MX TabNavigator container in Flex by setting the <code>tabWidth</code> style.</p>
<p><span id="more-3185"></span></p>
<p>In the following example the first TabNavigator container, <em>tn1</em>, allows Flex to control how wide each tab should be. The second TabNavigator container, <em>tn2</em>, sizes each tab equally, regardless of label length by setting the <code>tabWidth</code> style to the TabNavigator width divided by the number of tabs. The third and fourth TabNavigator container, <em>tn3</em> and <em>tn4</em>, set the TabNavigator container&#8217;s internal tab bar instance to the same width as the TabNavigator container. This allows the tabs to resize themselves based on the width of their content making it less likely that longer labels will truncate unnecessarily.</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/06/22/setting-the-tab-width-on-an-mx-tabnavigator-container-in-flex-3/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;MX_TabNavigator_tabWidth_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: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            protected function createCanvas(lbl:String):Canvas {</span>
<span style="color: #339933;">                var can:Canvas = new Canvas();</span>
<span style="color: #339933;">                can.label = lbl;</span>
<span style="color: #339933;">                return can;</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            protected function button1_clickHandler(evt:MouseEvent):void {</span>
<span style="color: #339933;">                tn1.addChild(createCanvas(&quot;C&quot;));</span>
<span style="color: #339933;">                tn2.addChild(createCanvas(&quot;C&quot;));</span>
<span style="color: #339933;">                tn3.addChild(createCanvas(&quot;C&quot;));</span>
<span style="color: #339933;">                tn4.addChild(createCanvas(&quot;C&quot;));</span>
&nbsp;
<span style="color: #339933;">                tn2.setStyle(&quot;tabWidth&quot;, tn2.width / tn2.numChildren);</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: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:Button</span> label=<span style="color: #ff0000;">&quot;Add Tab&quot;</span> click=<span style="color: #ff0000;">&quot;button1_clickHandler(event)&quot;</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:Form</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;Default sizing:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:TabNavigator</span> id=<span style="color: #ff0000;">&quot;tn1&quot;</span> width=<span style="color: #ff0000;">&quot;240&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> label=<span style="color: #ff0000;">&quot;Contacts&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> id=<span style="color: #ff0000;">&quot;lbl1&quot;</span> enterFrame=<span style="color: #ff0000;">&quot;lbl1.text = tn1.getTabAt(0).width.toString();&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:Canvas</span> label=<span style="color: #ff0000;">&quot;SMS&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:Canvas</span> label=<span style="color: #ff0000;">&quot;B&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:TabNavigator</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>
&nbsp;
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;Equal sizing:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:TabNavigator</span> id=<span style="color: #ff0000;">&quot;tn2&quot;</span></span>
<span style="color: #000000;">                    tabWidth=<span style="color: #ff0000;">&quot;{tn2.width/tn2.numChildren}&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;240&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> label=<span style="color: #ff0000;">&quot;Contacts&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> id=<span style="color: #ff0000;">&quot;lbl2&quot;</span></span>
<span style="color: #000000;">                            enterFrame=<span style="color: #ff0000;">&quot;lbl2.text = tn2.getTabAt(0).width.toString();&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:Canvas</span> label=<span style="color: #ff0000;">&quot;SMS&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:Canvas</span> label=<span style="color: #ff0000;">&quot;B&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:TabNavigator</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>
&nbsp;
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;Content sizing:&quot;</span> direction=<span style="color: #ff0000;">&quot;horizontal&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:TabNavigator</span> id=<span style="color: #ff0000;">&quot;tn3&quot;</span> width=<span style="color: #ff0000;">&quot;240&quot;</span> height=<span style="color: #ff0000;">&quot;100&quot;</span></span>
<span style="color: #000000;">                             resize=<span style="color: #ff0000;">&quot;event.currentTarget.mx_internal::getTabBar().width = event.currentTarget.width;&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> label=<span style="color: #ff0000;">&quot;Contacts&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> id=<span style="color: #ff0000;">&quot;lbl3&quot;</span> enterFrame=<span style="color: #ff0000;">&quot;lbl3.text = tn3.getTabAt(0).width.toString();&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:Canvas</span> label=<span style="color: #ff0000;">&quot;SMS&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:Canvas</span> label=<span style="color: #ff0000;">&quot;B&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:TabNavigator</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;local:ResizerTabNavigator</span> id=<span style="color: #ff0000;">&quot;tn4&quot;</span> width=<span style="color: #ff0000;">&quot;240&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> label=<span style="color: #ff0000;">&quot;Contacts&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> id=<span style="color: #ff0000;">&quot;lbl4&quot;</span> enterFrame=<span style="color: #ff0000;">&quot;lbl4.text = tn4.getTabAt(0).width.toString();&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:Canvas</span> label=<span style="color: #ff0000;">&quot;SMS&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:Canvas</span> label=<span style="color: #ff0000;">&quot;B&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;/local:ResizerTabNavigator</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>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>And the custom MX TabNavigator container, <em>ResizerTabNavigator.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/06/22/setting-the-tab-width-on-an-mx-tabnavigator-container-in-flex-3/ */</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>containers<span style="color: #000066; font-weight: bold;">.</span>TabNavigator<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>events<span style="color: #000066; font-weight: bold;">.</span>ResizeEvent<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> ResizerTabNavigator <span style="color: #0033ff; font-weight: bold;">extends</span> TabNavigator <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> ResizerTabNavigator<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>
            <span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ResizeEvent<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">RESIZE</span><span style="color: #000066; font-weight: bold;">,</span> resizeEventListener<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> resizeEventListener<span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span>ResizeEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            tabBar<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span> = <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</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 class="information"><a href="http://dl.dropbox.com/u/4509565/FlexExamples_com/MX_TabNavigator_tabWidth_test/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://dl.dropbox.com/u/4509565/FlexExamples_com/MX_TabNavigator_tabWidth_test/main.html" width="100%" height="450"></iframe></p>
<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>Or you can create the custom MX TabNavigator container in MXML 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/2010/06/22/setting-the-tab-width-on-an-mx-tabnavigator-container-in-flex-3/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;MX_TabNavigator_tabWidth_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:ResizerTabNavigatorMXML</span> id=<span style="color: #ff0000;">&quot;tn5&quot;</span> width=<span style="color: #ff0000;">&quot;240&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> label=<span style="color: #ff0000;">&quot;Contacts&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> id=<span style="color: #ff0000;">&quot;lbl5&quot;</span> enterFrame=<span style="color: #ff0000;">&quot;lbl5.text = tn5.getTabAt(0).width.toString();&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:Canvas</span> label=<span style="color: #ff0000;">&quot;SMS&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:Canvas</span> label=<span style="color: #ff0000;">&quot;B&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;/local:ResizerTabNavigatorMXML</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>And the custom MX TabNavigator container, <em>ResizerTabNavigatorMXML.mxml</em>, 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/2010/06/22/setting-the-tab-width-on-an-mx-tabnavigator-container-in-flex-3/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:TabNavigator</span> name=<span style="color: #ff0000;">&quot;ResizerTabNavigatorMXML&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;">        resize=<span style="color: #ff0000;">&quot;resizeEventListener(event);&quot;</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.ResizeEvent;</span>
&nbsp;
<span style="color: #339933;">            protected function resizeEventListener(evt:ResizeEvent):void {</span>
<span style="color: #339933;">                tabBar.width = this.width;</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:TabNavigator</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the tab width on an MX TabNavigator container in Flex 3 on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/06/22/setting-the-tab-width-on-an-mx-tabnavigator-container-in-flex-3/',contentID: 'post-3185',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'getTabAt(),getTabBar(),mx_internal,tabWidth',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/06/22/setting-the-tab-width-on-an-mx-tabnavigator-container-in-flex-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setting the label placement on a TabBar control in Flex</title>
		<link>http://blog.flexexamples.com/2008/10/06/setting-the-label-placement-on-a-tabbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/10/06/setting-the-label-placement-on-a-tabbar-control-in-flex/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 06:43:27 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TabBar]]></category>
		<category><![CDATA[getChildAt()]]></category>
		<category><![CDATA[labelPlacement]]></category>
		<category><![CDATA[numChildren]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/10/06/setting-the-label-placement-on-a-tabbar-control-in-flex/</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2007/11/19/styling-individual-tabs-in-a-tabbar-control/">&#8220;Styling individual tabs in a TabBar control&#8221;</a>, we saw how you could style individual tabs in a Flex TabBar control by calling the getChildAt() method on the tab bar, and then calling setStyle() on the returned Tab reference.</p> <p>The following example shows how you can loop over the tabs in [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2007/11/19/styling-individual-tabs-in-a-tabbar-control/">&#8220;Styling individual tabs in a TabBar control&#8221;</a>, we saw how you could style individual tabs in a Flex TabBar control by calling the <code>getChildAt()</code> method on the tab bar, and then calling <code>setStyle()</code> on the returned Tab reference.</p>
<p>The following example shows how you can loop over the tabs in a Flex TabBar control and set each tab&#8217;s <code>labelPlacement</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-820"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_getChildAt_labelPlacement_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/10/06/setting-the-label-placement-on-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_getChildAt_labelPlacement_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

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

            private function init():void {
                var tab:Tab;
                var idx:uint;
                var len:uint = tabBar.numChildren;
                for (idx=0; idx&lt;len; idx++) {
                    tab = tabBar.getChildAt(idx) as Tab;
                    tab.labelPlacement = tab.label;
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="left"
                icon="@Embed('assets/arrow_left.png')" /&gt;
        &lt;mx:Object label="right"
                icon="@Embed('assets/arrow_right.png')" /&gt;
        &lt;mx:Object label="top"
                icon="@Embed('assets/arrow_up.png')" /&gt;
        &lt;mx:Object label="bottom"
                icon="@Embed('assets/arrow_down.png')" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:TabBar id="tabBar"
            dataProvider="{arr}"
            tabWidth="150"
            tabHeight="60"
            creationComplete="init();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_getChildAt_labelPlacement_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/TabBar_getChildAt_labelPlacement_test/bin/main.html" width="100%" height="150"></iframe></p>
<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/TabBar_getChildAt_labelPlacement_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/10/06/setting-the-label-placement-on-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_getChildAt_labelPlacement_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.ButtonLabelPlacement;
            import mx.controls.TabBar;
            import mx.controls.tabBarClasses.Tab;

            [Embed("assets/arrow_left.png")]
            private const ARROW_LEFT_ICON:Class;

            [Embed("assets/arrow_right.png")]
            private const ARROW_RIGHT_ICON:Class;

            [Embed("assets/arrow_up.png")]
            private const ARROW_TOP_ICON:Class;

            [Embed("assets/arrow_down.png")]
            private const ARROW_BOTTOM_ICON:Class;

            private var arr:Array;
            private var tabBar:TabBar;

            private function init():void {
                arr = [];
                arr.push({label:ButtonLabelPlacement.LEFT,
                            icon:ARROW_LEFT_ICON});
                arr.push({label:ButtonLabelPlacement.RIGHT,
                            icon:ARROW_RIGHT_ICON});
                arr.push({label:ButtonLabelPlacement.TOP,
                            icon:ARROW_TOP_ICON});
                arr.push({label:ButtonLabelPlacement.BOTTOM,
                            icon:ARROW_BOTTOM_ICON});

                tabBar = new TabBar();
                tabBar.dataProvider = arr;
                tabBar.setStyle("tabWidth", 150);
                tabBar.setStyle("tabHeight", 60);
                addChild(tabBar);

                var tab:Tab;
                var idx:uint;
                var len:uint = tabBar.numChildren;
                for (idx=0; idx&lt;len; idx++) {
                    tab = tabBar.getChildAt(idx) as Tab;
                    tab.labelPlacement = tab.label;
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the label placement on a TabBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/10/06/setting-the-label-placement-on-a-tabbar-control-in-flex/',contentID: 'post-820',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'getChildAt(),labelPlacement,numChildren',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/10/06/setting-the-label-placement-on-a-tabbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting the text alignment on a TabBar control in Flex</title>
		<link>http://blog.flexexamples.com/2008/10/05/setting-the-text-alignment-on-a-tabbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/10/05/setting-the-text-alignment-on-a-tabbar-control-in-flex/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 19:53:43 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TabBar]]></category>
		<category><![CDATA[tabStyleName]]></category>
		<category><![CDATA[textAlign]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/10/05/setting-the-text-alignment-on-a-tabbar-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the text alignment on a Flex TabBar control by setting the tabStyleName, tabWidth, and textAlign styles.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_tabStyleName_textAlign_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/10/05/setting-the-text-alignment-on-a-tabbar-control-in-flex/ --&#62; &#60;mx:Application name="TabBar_tabStyleName_textAlign_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; .customTabStyleName { textAlign: center; } &#60;/mx:Style&#62; &#60;mx:Script&#62; &#60;![CDATA[ [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the text alignment on a Flex TabBar control by setting the <code>tabStyleName</code>, <code>tabWidth</code>, and <code>textAlign</code> styles.</p>
<p>Full code after the jump.</p>
<p><span id="more-819"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_tabStyleName_textAlign_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/10/05/setting-the-text-alignment-on-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_tabStyleName_textAlign_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        .customTabStyleName {
            textAlign: center;
        }
    &lt;/mx:Style&gt;

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

            private function comboBox_change(evt:ListEvent):void {
                var cssObj:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".customTabStyleName");
                cssObj.setStyle("textAlign", comboBox.selectedItem.label);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="comboBoxDP"&gt;
        &lt;mx:Object label="left" /&gt;
        &lt;mx:Object label="center" /&gt;
        &lt;mx:Object label="right" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:Array id="tabBarDP"&gt;
        &lt;mx:Object label="Red" /&gt;
        &lt;mx:Object label="Orange" /&gt;
        &lt;mx:Object label="Yellow" /&gt;
        &lt;mx:Object label="Green" /&gt;
        &lt;mx:Object label="Blue" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="textAlign:"&gt;
                &lt;mx:ComboBox id="comboBox"
                        dataProvider="{comboBoxDP}"
                        selectedIndex="1"
                        change="comboBox_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:TabBar id="tabBar"
            dataProvider="{tabBarDP}"
            tabWidth="120"
            tabStyleName="customTabStyleName" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_tabStyleName_textAlign_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/TabBar_tabStyleName_textAlign_test/bin/main.html" width="100%" height="150"></iframe></p>
<p>You can also set the <code>tabStyleName</code> and <code>textAlign</code> styles 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/TabBar_tabStyleName_textAlign_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/10/05/setting-the-text-alignment-on-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_tabStyleName_textAlign_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        TabBar {
            tabStyleName: customTabStyleName;
            tabWidth: 120;
        }

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

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Red" /&gt;
        &lt;mx:Object label="Orange" /&gt;
        &lt;mx:Object label="Yellow" /&gt;
        &lt;mx:Object label="Green" /&gt;
        &lt;mx:Object label="Blue" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:TabBar id="tabBar"
            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/TabBar_tabStyleName_textAlign_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/10/05/setting-the-text-alignment-on-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_tabStyleName_textAlign_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.TabBar;

            private var arr:Array;
            private var tabBar:TabBar;
            private var customTabStyleName:CSSStyleDeclaration;

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

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

                tabBar = new TabBar();
                tabBar.dataProvider = arr;
                tabBar.setStyle("tabWidth", 120);
                tabBar.setStyle("tabStyleName", "customTabStyleName");
                addChild(tabBar);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the text alignment on a TabBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/10/05/setting-the-text-alignment-on-a-tabbar-control-in-flex/',contentID: 'post-819',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'tabStyleName,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/10/05/setting-the-text-alignment-on-a-tabbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting the tab width on a TabBar control in Flex</title>
		<link>http://blog.flexexamples.com/2008/10/04/setting-the-tab-width-on-a-tabbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/10/04/setting-the-tab-width-on-a-tabbar-control-in-flex/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 05:25:19 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TabBar]]></category>
		<category><![CDATA[tabWidth]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/10/04/setting-the-tab-width-on-a-tabbar-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the tab width on a Flex TabBar control by setting the aptly named tabWidth style.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_tabWidth_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/10/04/setting-the-tab-width-on-a-tabbar-control-in-flex/ --&#62; &#60;mx:Application name="TabBar_tabWidth_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Array id="arr"&#62; &#60;mx:Object label="Red" /&#62; &#60;mx:Object label="Orange" /&#62; &#60;mx:Object label="Yellow" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the tab width on a Flex TabBar control by setting the aptly named <code>tabWidth</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-818"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_tabWidth_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/10/04/setting-the-tab-width-on-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_tabWidth_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Red" /&gt;
        &lt;mx:Object label="Orange" /&gt;
        &lt;mx:Object label="Yellow" /&gt;
        &lt;mx:Object label="Green" /&gt;
        &lt;mx:Object label="Blue" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="tabWidth:"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="40"
                        maximum="120"
                        value="100"
                        snapInterval="1"
                        tickInterval="10"
                        liveDragging="true" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:TabBar id="tabBar"
            dataProvider="{arr}"
            tabWidth="{slider.value}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_tabWidth_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/TabBar_tabWidth_test/bin/main.html" width="100%" height="150"></iframe></p>
<p>You can also set the <code>tabWidth</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/TabBar_tabWidth_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/10/04/setting-the-tab-width-on-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_tabWidth_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        TabBar {
            tabWidth: 120;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Red" /&gt;
        &lt;mx:Object label="Orange" /&gt;
        &lt;mx:Object label="Yellow" /&gt;
        &lt;mx:Object label="Green" /&gt;
        &lt;mx:Object label="Blue" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:TabBar id="tabBar"
            dataProvider="{arr}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>tabWidth</code> style using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_tabWidth_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/10/04/setting-the-tab-width-on-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_tabWidth_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

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

            private function slider_change(evt:SliderEvent):void {
                tabBar.setStyle("tabWidth", evt.value);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Red" /&gt;
        &lt;mx:Object label="Orange" /&gt;
        &lt;mx:Object label="Yellow" /&gt;
        &lt;mx:Object label="Green" /&gt;
        &lt;mx:Object label="Blue" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="tabWidth:"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="40"
                        maximum="120"
                        value="100"
                        snapInterval="1"
                        tickInterval="10"
                        liveDragging="true"
                        change="slider_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:TabBar id="tabBar"
            dataProvider="{arr}"
            tabWidth="100" /&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/TabBar_tabWidth_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/10/04/setting-the-tab-width-on-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_tabWidth_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.Form;
            import mx.containers.FormItem;
            import mx.controls.HSlider;
            import mx.controls.TabBar;
            import mx.events.SliderEvent;

            private var arr:Array;
            private var slider:HSlider;
            private var tabBar:TabBar;

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

                slider = new HSlider();
                slider.minimum = 40;
                slider.maximum = 120;
                slider.value = 100;
                slider.snapInterval = 1;
                slider.tickInterval = 10;
                slider.liveDragging = true;
                slider.addEventListener(SliderEvent.CHANGE,
                            slider_change);

                var formItem:FormItem = new FormItem();
                formItem.label = "tabWidth:";
                formItem.addChild(slider);

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

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

                tabBar = new TabBar();
                tabBar.dataProvider = arr;
                tabBar.setStyle("tabWidth", slider.value);
                addChild(tabBar);
            }

            private function slider_change(evt:SliderEvent):void {
                tabBar.setStyle("tabWidth", evt.value);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the tab width on a TabBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/10/04/setting-the-tab-width-on-a-tabbar-control-in-flex/',contentID: 'post-818',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'tabWidth',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/10/04/setting-the-tab-width-on-a-tabbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using an embedded font with the TabBar control in Flex</title>
		<link>http://blog.flexexamples.com/2008/06/07/using-an-embedded-font-with-the-tabbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/06/07/using-an-embedded-font-with-the-tabbar-control-in-flex/#comments</comments>
		<pubDate>Sun, 08 Jun 2008 06:47:27 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TabBar]]></category>
		<category><![CDATA[fontFamily]]></category>
		<category><![CDATA[fontWeight]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/07/using-an-embedded-font-with-the-tabbar-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can use an embedded font with the Flex TabBar control by setting the fontFamily and fontWeight styles.</p> <p></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/06/07/using-an-embedded-font-with-the-tabbar-control-in-flex/ --&#62; &#60;mx:Application name="TabBar_fontFamily_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; @font-face { src: local("Base 02"); fontFamily: EmbeddedBase02; fontWeight: bold; } &#60;/mx:Style&#62; &#60;mx:VBox id="vBox" verticalGap="0" width="320" height="200"&#62; &#60;mx:TabBar id="tabBar" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can use an embedded font with the Flex TabBar control by setting the <code>fontFamily</code> and <code>fontWeight</code> styles.</p>
<p><span id="more-661"></span></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/07/using-an-embedded-font-with-the-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_fontFamily_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: local("Base 02");
            fontFamily: EmbeddedBase02;
            fontWeight: bold;
        }
    &lt;/mx:Style&gt;

    &lt;mx:VBox id="vBox"
            verticalGap="0"
            width="320"
            height="200"&gt;
        &lt;mx:TabBar id="tabBar"
                dataProvider="{viewStack}"
                fontFamily="EmbeddedBase02"
                width="100%" /&gt;
        &lt;mx:ViewStack id="viewStack"
                width="100%"
                height="100%"
                backgroundColor="white"&gt;
            &lt;mx:VBox label="One"&gt;
                &lt;mx:Label text="one..." /&gt;
            &lt;/mx:VBox&gt;
            &lt;mx:VBox label="Two"&gt;
                &lt;mx:Label text="two..." /&gt;
            &lt;/mx:VBox&gt;
            &lt;mx:VBox label="Three"&gt;
                &lt;mx:Label text="three..." /&gt;
            &lt;/mx:VBox&gt;
            &lt;mx:VBox label="Four"&gt;
                &lt;mx:Label text="four..." /&gt;
            &lt;/mx:VBox&gt;
            &lt;mx:VBox label="Five"&gt;
                &lt;mx:Label text="five..." /&gt;
            &lt;/mx:VBox&gt;
        &lt;/mx:ViewStack&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_fontFamily_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/TabBar_fontFamily_test/bin/main.html" width="100%" height="300"></iframe></p>
<p>You can also set the <code>fontFamily</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/TabBar_fontFamily_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/07/using-an-embedded-font-with-the-tabbar-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: local(&quot;Base 02&quot;);
            fontFamily: EmbeddedBase02;
            fontWeight: bold;
        }

        <strong style="color:red;">TabBar {
            fontFamily: EmbeddedBase02;
        }</strong>
    &lt;/mx:Style&gt;

    &lt;mx:VBox id=&quot;vBox&quot;
            verticalGap=&quot;0&quot;
            width=&quot;320&quot;
            height=&quot;200&quot;&gt;
        &lt;mx:TabBar id=&quot;tabBar&quot;
                dataProvider=&quot;{viewStack}&quot;
                width=&quot;100%&quot; /&gt;
        &lt;mx:ViewStack id=&quot;viewStack&quot;
                width=&quot;100%&quot;
                height=&quot;100%&quot;
                backgroundColor=&quot;white&quot;&gt;
            &lt;mx:VBox label=&quot;One&quot;&gt;
                &lt;mx:Label text=&quot;one...&quot; /&gt;
            &lt;/mx:VBox&gt;
            &lt;mx:VBox label=&quot;Two&quot;&gt;
                &lt;mx:Label text=&quot;two...&quot; /&gt;
            &lt;/mx:VBox&gt;
            &lt;mx:VBox label=&quot;Three&quot;&gt;
                &lt;mx:Label text=&quot;three...&quot; /&gt;
            &lt;/mx:VBox&gt;
            &lt;mx:VBox label=&quot;Four&quot;&gt;
                &lt;mx:Label text=&quot;four...&quot; /&gt;
            &lt;/mx:VBox&gt;
            &lt;mx:VBox label=&quot;Five&quot;&gt;
                &lt;mx:Label text=&quot;five...&quot; /&gt;
            &lt;/mx:VBox&gt;
        &lt;/mx:ViewStack&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>fontFamily</code> style using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_fontFamily_test/bin/srcview/source/main3.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/07/using-an-embedded-font-with-the-tabbar-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: local(&quot;Base 02&quot;);
            fontFamily: EmbeddedBase02;
            fontWeight: bold;
        }
    &lt;/mx:Style&gt;

    <strong style="color:red;">&lt;mx:Script&gt;
        &lt;![CDATA[
            private function init():void {
                tabBar.setStyle(&quot;fontFamily&quot;, &quot;EmbeddedBase02&quot;);
            }
        ]]&gt;
    &lt;/mx:Script&gt;</strong>

    &lt;mx:VBox id=&quot;vBox&quot;
            verticalGap=&quot;0&quot;
            width=&quot;320&quot;
            height=&quot;200&quot;&gt;
        &lt;mx:TabBar id=&quot;tabBar&quot;
                dataProvider=&quot;{viewStack}&quot;
                width=&quot;100%&quot;
                <strong style="color:red;">initialize=&quot;init();&quot;</strong> /&gt;
        &lt;mx:ViewStack id=&quot;viewStack&quot;
                width=&quot;100%&quot;
                height=&quot;100%&quot;
                backgroundColor=&quot;white&quot;&gt;
            &lt;mx:VBox label=&quot;One&quot;&gt;
                &lt;mx:Label text=&quot;one...&quot; /&gt;
            &lt;/mx:VBox&gt;
            &lt;mx:VBox label=&quot;Two&quot;&gt;
                &lt;mx:Label text=&quot;two...&quot; /&gt;
            &lt;/mx:VBox&gt;
            &lt;mx:VBox label=&quot;Three&quot;&gt;
                &lt;mx:Label text=&quot;three...&quot; /&gt;
            &lt;/mx:VBox&gt;
            &lt;mx:VBox label=&quot;Four&quot;&gt;
                &lt;mx:Label text=&quot;four...&quot; /&gt;
            &lt;/mx:VBox&gt;
            &lt;mx:VBox label=&quot;Five&quot;&gt;
                &lt;mx:Label text=&quot;five...&quot; /&gt;
            &lt;/mx:VBox&gt;
        &lt;/mx:ViewStack&gt;
    &lt;/mx:VBox&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/TabBar_fontFamily_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/06/07/using-an-embedded-font-with-the-tabbar-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        xmlns:comps="comps.*"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;comps:MyComp /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_fontFamily_test/bin/srcview/source/comps/MyComp.as.html">comps/MyComp.as</a></p>
<pre class="code">
package comps {
    import mx.containers.VBox;
    import mx.containers.ViewStack;
    import mx.controls.Label;
    import mx.controls.TabBar;
    import mx.core.Container;

    public class MyComp extends VBox {
        [Embed(systemFont="Base 02",
                fontName="EmbeddedBase02",
                fontWeight="bold",
                advancedAntiAliasing="true",
                mimeType="application/x-font")]
        private var EmbeddedBase02:Class;

        public var tabBar:TabBar;
        public var viewStack:ViewStack;
        public var child1:Container;
        public var child2:Container;
        public var child3:Container;
        public var child4:Container;
        public var child5:Container;

        public function MyComp() {
            super();
            init();
        }

        private function init():void {
            setStyle("verticalGap", 0);
            width = 320;
            height = 240;

            var label1:Label;
            var label2:Label;
            var label3:Label;
            var label4:Label;
            var label5:Label;

            label1 = new Label();
            label1.text =  "one...";

            label2 = new Label();
            label2.text =  "two...";

            label3 = new Label();
            label3.text =  "three...";

            label4 = new Label();
            label4.text =  "four...";

            label5 = new Label();
            label5.text =  "five...";

            child1 = new VBox();
            child1.label = "One";
            child1.addChild(label1);

            child2 = new VBox();
            child2.label = "Two";
            child2.addChild(label2);

            child3 = new VBox();
            child3.label = "Three";
            child3.addChild(label3);

            child4 = new VBox();
            child4.label = "Four";
            child4.addChild(label4);

            child5 = new VBox();
            child5.label = "Five";
            child5.addChild(label5);

            viewStack = new ViewStack();
            viewStack.percentWidth = 100;
            viewStack.percentHeight = 100;
            viewStack.setStyle("backgroundColor", "white");
            viewStack.addChild(child1);
            viewStack.addChild(child2);
            viewStack.addChild(child3);
            viewStack.addChild(child4);
            viewStack.addChild(child5);
            addChild(viewStack);

            tabBar = new TabBar();
            tabBar.dataProvider = viewStack;
            tabBar.percentWidth = 100;
            tabBar.setStyle("fontFamily", "EmbeddedBase02");
            addChildAt(tabBar, 0)
        }
    }
}
</pre>
<p>And finally, if you wanted to use a normal font weight instead of the default bold font weight, you could use the following snippet:</p>
<pre class="code">
&lt;mx:Style&gt;
    @font-face {
        src: local("Base 02");
        fontFamily: EmbeddedBase02;
        fontWeight: normal;
    }

    TabBar {
        fontFamily: EmbeddedBase02;
        tabStyleName: normalTabStyleName;
        selectedTabTextStyleName: normalTabStyleName;
    }

    .normalTabStyleName {
        fontWeight: normal;
    }
&lt;/mx:Style&gt;
</pre>
<p class="alert">Base 02 font by <a href="http://www.stereo-type.net/">www.stereo-type.net</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Using an embedded font with the TabBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/06/07/using-an-embedded-font-with-the-tabbar-control-in-flex/',contentID: 'post-661',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'fontFamily,fontWeight',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/06/07/using-an-embedded-font-with-the-tabbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vertically aligning tabs within a TabBar control in Flex</title>
		<link>http://blog.flexexamples.com/2008/03/20/vertically-aligning-tabs-within-a-tabbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/03/20/vertically-aligning-tabs-within-a-tabbar-control-in-flex/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 07:54:49 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TabBar]]></category>
		<category><![CDATA[selectedTabTextStyleName]]></category>
		<category><![CDATA[tabStyleName]]></category>
		<category><![CDATA[verticalAlign]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/03/20/vertically-aligning-tabs-within-a-tabbar-control-in-flex/</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/03/19/horizontally-aligning-tabs-within-a-tabbar-control-in-flex/">&#8220;Horizontally aligning tabs within a TabBar control in Flex&#8221;</a>, we saw how you could horizontally align tabs in a TabBar control by setting the horizontalAlign style.</p> <p>The following example shows how you can align tabs vertically within a Flex TabBar control by setting the verticalAlign style.</p> <p>Full code after the [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/03/19/horizontally-aligning-tabs-within-a-tabbar-control-in-flex/">&#8220;Horizontally aligning tabs within a TabBar control in Flex&#8221;</a>, we saw how you could horizontally align tabs in a TabBar control by setting the <code>horizontalAlign</code> style.</p>
<p>The following example shows how you can align tabs vertically within a Flex TabBar control by setting the <code>verticalAlign</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-567"></span></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/03/20/vertically-aligning-tabs-within-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        TabBar {
            tabStyleName: myCustomTabStyleName;
            selectedTabTextStyleName: myCustomSelectedTabTextStyleName;
        }

        .myCustomTabStyleName {
            fillColors: haloBlue, haloGreen;
            fillAlphas: 1.0, 1.0;
        }

        .myCustomSelectedTabTextStyleName {
            color: white;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Button" /&gt;
        &lt;mx:Object label="ButtonBar" /&gt;
        &lt;mx:Object label="ColorPicker" /&gt;
        &lt;mx:Object label="ComboBox" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="verticalAlign:"&gt;
                &lt;mx:ComboBox id="comboBox"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Array&gt;
                            &lt;mx:Object label="top" /&gt;
                            &lt;mx:Object label="middle" /&gt;
                            &lt;mx:Object label="bottom" /&gt;
                        &lt;/mx:Array&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ComboBox&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Box backgroundColor="black"&gt;
        &lt;mx:TabBar id="tabBar"
                dataProvider="{arr}"
                height="200"
                tabWidth="100"
                tabHeight="40"
                verticalAlign="{comboBox.selectedItem.label}"
                direction="vertical" /&gt;
    &lt;/mx:Box&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Vertically aligning tabs within a TabBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/03/20/vertically-aligning-tabs-within-a-tabbar-control-in-flex/',contentID: 'post-567',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'selectedTabTextStyleName,tabStyleName,verticalAlign',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/03/20/vertically-aligning-tabs-within-a-tabbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Horizontally aligning tabs within a TabBar control in Flex</title>
		<link>http://blog.flexexamples.com/2008/03/19/horizontally-aligning-tabs-within-a-tabbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/03/19/horizontally-aligning-tabs-within-a-tabbar-control-in-flex/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 06:55:10 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TabBar]]></category>
		<category><![CDATA[horizontalAlign]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/03/19/horizontally-aligning-tabs-within-a-tabbar-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can align tabs within a Flex TabBar control by setting the horizontalAlign style.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_horizontalAlign_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/03/19/horizontally-aligning-tabs-within-a-tabbar-control-in-flex/ --&#62; &#60;mx:Application name="TabBar_horizontalAlign_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Array id="arr"&#62; &#60;mx:Object label="Button" /&#62; &#60;mx:Object label="ButtonBar" /&#62; &#60;mx:Object label="ColorPicker" /&#62; &#60;mx:Object label="ComboBox" /&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can align tabs within a Flex TabBar control by setting the <code>horizontalAlign</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-446"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_horizontalAlign_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/03/19/horizontally-aligning-tabs-within-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_horizontalAlign_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Button" /&gt;
        &lt;mx:Object label="ButtonBar" /&gt;
        &lt;mx:Object label="ColorPicker" /&gt;
        &lt;mx:Object label="ComboBox" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="horizontalAlign:"&gt;
                &lt;mx:ComboBox id="comboBox"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Array&gt;
                            &lt;mx:Object label="left" /&gt;
                            &lt;mx:Object label="center" /&gt;
                            &lt;mx:Object label="right" /&gt;
                        &lt;/mx:Array&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ComboBox&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Box backgroundColor="haloSilver"&gt;
        &lt;mx:TabBar id="tabBar"
                dataProvider="{arr}"
                width="600"
                tabWidth="100"
                tabHeight="40"
                horizontalAlign="{comboBox.selectedItem.label}"
                direction="horizontal" /&gt;
    &lt;/mx:Box&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_horizontalAlign_test/bin/srcview.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/TabBar_horizontalAlign_test/bin/main.html" width="100%" height="200"></iframe></p>
<p>You can also set the <code>horizontalAlign</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/TabBar_horizontalAlign_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/03/19/horizontally-aligning-tabs-within-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_horizontalAlign_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        TabBar {
            horizontalAlign: center;
            tabWidth: 100;
            tabHeight: 40;
        }

    &lt;/mx:Style&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Button" /&gt;
        &lt;mx:Object label="ButtonBar" /&gt;
        &lt;mx:Object label="ColorPicker" /&gt;
        &lt;mx:Object label="ComboBox" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:Box backgroundColor="haloSilver"&gt;
        &lt;mx:TabBar id="tabBar"
                dataProvider="{arr}"
                width="600"
                direction="horizontal" /&gt;
    &lt;/mx:Box&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>horizontalAlign</code> style using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_horizontalAlign_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/03/19/horizontally-aligning-tabs-within-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_horizontalAlign_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

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

            private function comboBox_change(evt:ListEvent):void {
                tabBar.setStyle("horizontalAlign", comboBox.selectedItem.label);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Button" /&gt;
        &lt;mx:Object label="ButtonBar" /&gt;
        &lt;mx:Object label="ColorPicker" /&gt;
        &lt;mx:Object label="ComboBox" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="horizontalAlign:"&gt;
                &lt;mx:ComboBox id="comboBox"
                        change="comboBox_change(event);"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Array&gt;
                            &lt;mx:Object label="left" /&gt;
                            &lt;mx:Object label="center" /&gt;
                            &lt;mx:Object label="right" /&gt;
                        &lt;/mx:Array&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ComboBox&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Box backgroundColor="haloSilver"&gt;
        &lt;mx:TabBar id="tabBar"
                dataProvider="{arr}"
                width="600"
                tabWidth="100"
                tabHeight="40"
                direction="horizontal" /&gt;
    &lt;/mx:Box&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/TabBar_horizontalAlign_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/03/19/horizontally-aligning-tabs-within-a-tabbar-control-in-flex/ --&gt;
&lt;mx:Application name="TabBar_horizontalAlign_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.BoxDirection;
            import mx.containers.Box;
            import mx.containers.ApplicationControlBar;
            import mx.containers.Form;
            import mx.containers.FormItem;
            import mx.controls.TabBar;
            import mx.controls.ComboBox;
            import mx.events.ListEvent;

            private var arr:Array;
            private var comboBox:ComboBox;
            private var tabBar:TabBar;

            private function init():void {
                arr = [];
                arr.push({label:"Button"});
                arr.push({label:"ButtonBar"});
                arr.push({label:"ColorPicker"});
                arr.push({label:"ComboBox"});

                var dp:Array = [];
                dp.push({label:"left"});
                dp.push({label:"center"});
                dp.push({label:"right"});

                comboBox = new ComboBox();
                comboBox.dataProvider = dp;
                comboBox.addEventListener(ListEvent.CHANGE,
                            comboBox_change);

                var formItem:FormItem = new FormItem();
                formItem.label = "horizontalAlign:";
                formItem.addChild(comboBox);

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

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

                tabBar = new TabBar();
                tabBar.dataProvider = arr;
                tabBar.width = 600;
                tabBar.setStyle("tabWidth", 100);
                tabBar.setStyle("tabHeight", 40);
                tabBar.direction = BoxDirection.HORIZONTAL;

                var box:Box = new Box();
                box.setStyle("backgroundColor", "haloSilver");
                box.addChild(tabBar);
                addChild(box);
            }

            private function comboBox_change(evt:ListEvent):void {
                tabBar.setStyle("horizontalAlign",
                            comboBox.selectedItem.label);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Horizontally aligning tabs within a TabBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/03/19/horizontally-aligning-tabs-within-a-tabbar-control-in-flex/',contentID: 'post-446',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'horizontalAlign',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/03/19/horizontally-aligning-tabs-within-a-tabbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling individual tabs in a TabBar control</title>
		<link>http://blog.flexexamples.com/2007/11/19/styling-individual-tabs-in-a-tabbar-control/</link>
		<comments>http://blog.flexexamples.com/2007/11/19/styling-individual-tabs-in-a-tabbar-control/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 02:01:37 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TabBar]]></category>
		<category><![CDATA[backgroundColor]]></category>
		<category><![CDATA[fillAlphas]]></category>
		<category><![CDATA[fillColors]]></category>
		<category><![CDATA[getChildAt()]]></category>
		<category><![CDATA[tab]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/19/styling-individual-tabs-in-a-tabbar-control/</guid>
		<description><![CDATA[<p>The following example shows how you can style individual tabs in a Flex TabBar control by calling the getChildAt() method on the tab bar, and then calling setStyle() on the returned Tab reference.</p> <p>A big thanks to <a href="http://butterfliesandbugs.wordpress.com/">Joan</a> for helping me figure it out.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version=&#34;1.0&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2007/11/19/styling-individual-tabs-in-a-tabbar-control/ [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can style individual tabs in a Flex TabBar control by calling the <code>getChildAt()</code> method on the tab bar, and then calling <code>setStyle()</code> on the returned Tab reference.</p>
<p>A big thanks to <a href="http://butterfliesandbugs.wordpress.com/">Joan</a> for helping me figure it out.</p>
<p>Full code after the jump.</p>
<p><span id="more-313"></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>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2007/11/19/styling-individual-tabs-in-a-tabbar-control/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;TabBar_getChildAt_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: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">    &lt;![CDATA[</span>
<span style="color: #339933;">        import mx.events.ItemClickEvent;</span>
<span style="color: #339933;">        import mx.controls.tabBarClasses.Tab;</span>
&nbsp;
<span style="color: #339933;">        private function tabBar_creationComplete():void {</span>
<span style="color: #339933;">            var colorArr:Array = [&quot;red&quot;, &quot;haloOrange&quot;, &quot;yellow&quot;, &quot;haloGreen&quot;, &quot;haloBlue&quot;];</span>
<span style="color: #339933;">            var color:String;</span>
<span style="color: #339933;">            var tab:Tab;</span>
<span style="color: #339933;">            var idx:uint;</span>
<span style="color: #339933;">            var len:uint = tabBar.dataProvider.length;</span>
&nbsp;
<span style="color: #339933;">            for (idx = 0; idx &lt; len; idx++) {</span>
<span style="color: #339933;">                var i:int = idx % colorArr.length;</span>
<span style="color: #339933;">                color = colorArr[i];</span>
<span style="color: #339933;">                tab = Tab(tabBar.getChildAt(idx));</span>
<span style="color: #339933;">                tab.setStyle(&quot;fillColors&quot;, [color, &quot;white&quot;]);</span>
<span style="color: #339933;">                tab.setStyle(&quot;fillAlphas&quot;, [1.0, 1.0]);</span>
<span style="color: #339933;">                tab.setStyle(&quot;backgroundColor&quot;, color);</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        }</span>
&nbsp;
<span style="color: #339933;">        private function tabBar_itemClick(evt:ItemClickEvent):void {</span>
<span style="color: #339933;">            viewStack.selectedIndex = evt.index;</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;Red&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;Orange&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;Yellow&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;Green&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;Blue&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:TabBar</span> id=<span style="color: #ff0000;">&quot;tabBar&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;{arr}&quot;</span></span>
<span style="color: #000000;">            creationComplete=<span style="color: #ff0000;">&quot;tabBar_creationComplete();&quot;</span></span>
<span style="color: #000000;">            itemClick=<span style="color: #ff0000;">&quot;tabBar_itemClick(event);&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;">            width=<span style="color: #ff0000;">&quot;{tabBar.width}&quot;</span></span>
<span style="color: #000000;">            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:VBox</span> id=<span style="color: #ff0000;">&quot;redVBox&quot;</span> width=<span style="color: #ff0000;">&quot;100%&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:Label</span> text=<span style="color: #ff0000;">&quot;Red VBox&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:VBox</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:VBox</span> id=<span style="color: #ff0000;">&quot;orangeVBox&quot;</span> width=<span style="color: #ff0000;">&quot;100%&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:Label</span> text=<span style="color: #ff0000;">&quot;Orange VBox&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:VBox</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:VBox</span> id=<span style="color: #ff0000;">&quot;yellowVBox&quot;</span> width=<span style="color: #ff0000;">&quot;100%&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:Label</span> text=<span style="color: #ff0000;">&quot;Yellow VBox&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:VBox</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:VBox</span> id=<span style="color: #ff0000;">&quot;greenVBox&quot;</span> width=<span style="color: #ff0000;">&quot;100%&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:Label</span> text=<span style="color: #ff0000;">&quot;Green VBox&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:VBox</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:VBox</span> id=<span style="color: #ff0000;">&quot;blueVBox&quot;</span> width=<span style="color: #ff0000;">&quot;100%&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:Label</span> text=<span style="color: #ff0000;">&quot;Blue VBox&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:VBox</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 class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_getChildAt_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/TabBar_getChildAt_test/bin/main.html" width="100%" height="200"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Styling individual tabs in a TabBar control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/19/styling-individual-tabs-in-a-tabbar-control/',contentID: 'post-313',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'backgroundColor,fillAlphas,fillColors,getChildAt(),tab',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/2007/11/19/styling-individual-tabs-in-a-tabbar-control/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Controlling the distance between tabs in a TabBar control using the horizontalGap style</title>
		<link>http://blog.flexexamples.com/2007/11/02/controlling-the-distance-between-tabs-in-a-tabbar-control-using-the-horizontalgap-style/</link>
		<comments>http://blog.flexexamples.com/2007/11/02/controlling-the-distance-between-tabs-in-a-tabbar-control-using-the-horizontalgap-style/#comments</comments>
		<pubDate>Sat, 03 Nov 2007 04:42:50 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TabBar]]></category>
		<category><![CDATA[horizontalGap]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/02/controlling-the-distance-between-tabs-in-a-tabbar-control-using-the-horizontalgap-style/</guid>
		<description><![CDATA[<p>The following example shows how you can control the spacing between tabs in a Flex TabBar control by setting the horizontalGap style.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_horizontalGap_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/11/02/controlling-the-distance-between-tabs-in-a-tabbar-control-using-the-horizontalgap-style/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Array id="arr"&#62; &#60;mx:Object label="The quick" /&#62; &#60;mx:Object label="brown fox" /&#62; &#60;mx:Object label="jumped [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can control the spacing between tabs in a Flex TabBar control by setting the <code>horizontalGap</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-262"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_horizontalGap_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/02/controlling-the-distance-between-tabs-in-a-tabbar-control-using-the-horizontalgap-style/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="The quick" /&gt;
        &lt;mx:Object label="brown fox" /&gt;
        &lt;mx:Object label="jumped over" /&gt;
        &lt;mx:Object label="the lazy fox" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form&gt;
            &lt;mx:FormItem label="horizontalGap:"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="-5"
                        maximum="10"
                        value="-1"
                        liveDragging="true"
                        snapInterval="1"
                        tickInterval="1" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:TabBar id="tabBar"
            horizontalGap="{slider.value}"
            dataProvider="{arr}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TabBar_horizontalGap_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/TabBar_horizontalGap_test/bin/main.html" width="100%" height="150"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Controlling the distance between tabs in a TabBar control using the horizontalGap style on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/02/controlling-the-distance-between-tabs-in-a-tabbar-control-using-the-horizontalgap-style/',contentID: 'post-262',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'horizontalGap',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/2007/11/02/controlling-the-distance-between-tabs-in-a-tabbar-control-using-the-horizontalgap-style/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

