Controlling the distance between tabs in a TabBar control using the horizontalGap style

by Peter deHaan on November 2, 2007

in TabBar

The following example shows how you can control the spacing between tabs in a Flex TabBar control by setting the horizontalGap style.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/11/02/controlling-the-distance-between-tabs-in-a-tabbar-control-using-the-horizontalgap-style/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Array id="arr">
        <mx:Object label="The quick" />
        <mx:Object label="brown fox" />
        <mx:Object label="jumped over" />
        <mx:Object label="the lazy fox" />
    </mx:Array>

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

    <mx:TabBar id="tabBar"
            horizontalGap="{slider.value}"
            dataProvider="{arr}" />

</mx:Application>

View source is enabled in the following example.

{ 1 comment… read it below or add one }

1 theLoggerGuy November 6, 2007 at 7:41 pm

Peterd,

this is a bit off topic, but I was wondering how you might go about moving the tab buttons from the top to the bottom of a TabNavigator. I have been hunting the web and I see a lot of people asking for the same thing, but no solution (except the one here: http://www.richinternetapps.com/archives/2005_04.html, which doesn’t work for Flex 3).

Cheers.

Reply

Leave a Comment

Sorry, this blog is terrible at eating HTML comments.
If you're pasting any HTML/XML/MXML code, you need to convert your < characters to &lt; and your > characters to &gt; .

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree

Previous post:

Next post: