Creating a custom skin on the Spark TabBar control in Flex 4

The following example shows how you can create a custom RadioButton based skin on the Spark TabBar control in Flex 4 by setting the skinClass style.

The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see To download the latest nightly build of the Flex 4 SDK, see

For more information on getting started with Flex 4 and Flash Builder 4, see the official Adobe Flex Team blog.

<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<s:Application name="Spark_TabBar_skinClass_test"
    <s:VGroup horizontalAlign="center"
            horizontalCenter="0" verticalCenter="0">
        <mx:ViewStack id="vs" width="300" height="100">
            <s:NavigatorContent label="One"
                    width="100%" height="100%" />
            <s:NavigatorContent label="Two"
                    width="100%" height="100%" />
            <s:NavigatorContent label="Three"
                    width="100%" height="100%" />
            <s:NavigatorContent label="Four"
                    width="100%" height="100%" />
            <s:NavigatorContent label="Five"
                    width="100%" height="100%" />
        <s:TabBar dataProvider="{vs}" skinClass="skins.CustomSparkTabBarSkin" />

And the custom Spark TabBar skin class, skins/CustomSparkTabBarSkin.mxml, is as follows:

<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<spark:TabBarSkin name="CustomSparkTabBarSkin"
    <s:DataGroup id="dataGroup" width="100%" height="100%">
            <s:ButtonBarHorizontalLayout gap="-1"/>
                <s:RadioButton />

View source is enabled in the following example.

This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.

3 thoughts on “Creating a custom skin on the Spark TabBar control in Flex 4

  1. I’m trying to use something similar except I have

    I’m looking for a way to swap out the Type of item in the inline renderer so as to achive decoupling.

    I want to use multiple app specific components which extend my CustomButtonBarButton but all use the same skin.

    Is this achivable without making a diferent skin for each?

      1. why doesn’t it work…?

        well : inside the fx component tag I have a CustomButtonBarButton with a skinClass

        that’s basically it

Comments are closed.