Removing the increment and decrement buttons on a FxVScrollBar control in Flex Gumbo

The following example shows how you can remove the increment and decrement buttons on a Flex Gumbo FxVScrollBar control by creating a custom skin and setting the skinClass style.

Full code after the jump.

To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see “Using the beta Gumbo SDK in Flex Builder 3”.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/02/26/removing-the-increment-and-decrement-buttons-on-a-fxvscrollbar-control-in-flex-gumbo/ -->
<FxApplication name="FxVScrollBar_skinClass_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        backgroundColor="white">

    <Style>
        FxTextArea FxVScrollBar {
            skinClass: ClassReference("MyVScrollBarSkin");
        }
    </Style>

    <VGroup horizontalCenter="0" verticalCenter="0">
        <FxTextArea id="textArea"
                verticalScrollPolicy="on"
                editable="false">
            <content>
                <String source="lipsum.html" />
            </content>
        </FxTextArea>

        <FxVScrollBar id="vsb"
                minimum="0"
                maximum="1000" />
    </VGroup>

</FxApplication>

And the custom FxVScrollBar skin, MyVScrollBarSkin.mxml, is as follows:

View MyVScrollBarSkin.mxml

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/02/26/removing-the-increment-and-decrement-buttons-on-a-fxvscrollbar-control-in-flex-gumbo/ -->
<SparkSkin xmlns="http://ns.adobe.com/mxml/2009"
      minWidth="15" minHeight="35"
      alpha.disabled="0.5">

    <states>
        <State name="normal" />
        <State name="disabled" />
    </states>

    <Metadata>
        [HostComponent("mx.components.FxVScrollBar")]
    </Metadata>

    <Script>
        static private const exclusions:Array = ["track", "thumb"];
        override public function get colorizeExclusions():Array {return exclusions;}
    </Script>

    <FxButton id="track" top="0" bottom="0" height="54"
              focusEnabled="false"
              skinClass="mx.skins.spark.FxVScrollBarTrackSkin" />

    <FxButton id="thumb"
              focusEnabled="false"
              skinClass="mx.skins.spark.FxVScrollBarThumbSkin" />

</SparkSkin>

This entry is based on a beta version of the Flex Gumbo 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 Gumbo SDK.