Styling the decrement button and increment button on a Spark VScrollBar control in Flex 4

The following example shows how you can use advanced CSS to style the decrement and decrement buttons on a Spark TextArea control’s vertical scroll bar in Flex 4 by styling the #decrementButton and #incrementButton selectors.

Full code after the jump.

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

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/02/27/styling-the-decrement-button-and-increment-button-on-an-fxvscrollbar-control-in-flex-gumbo/ -->
<s:Application name="Spark_TextArea_VScrollBar_decrementButton_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo">

    <fx:Style>
        @namespace s "library://ns.adobe.com/flex/spark";

        s|TextArea s|VScrollBar #decrementButton {
            baseColor: #FF0000;
        }

        s|TextArea s|VScrollBar #incrementButton {
            baseColor: haloGreen;
        }
    </fx:Style>

    <s:TextArea id="textArea"
            text="The quick brown fox jumps over the lazy dog."
            verticalScrollPolicy="on"
            horizontalScrollPolicy="on"
            horizontalCenter="0"
            verticalCenter="0" />

</s:Application>

View source is enabled in the following example.

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.