Creating a transparent Spark TextArea control in Flex 4

The following example shows how you can create a semi-transparent Spark TextArea control in Flex 4 by creating a custom skin and setting the alpha property on the background fill.

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 xmlns:fx=""

    <s:TextArea id="textArea"
        <s:text>The quick brown fox jumps over the lazy dog.</s:text>


And the custom skin class, skins/CustomTextAreaSkin.mxml, is as follows:

<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<s:SparkSkin name="CustomTextAreaSkin"
        minWidth="36" minHeight="36"
        <s:State name="normal"/>
        <s:State name="disabled"/>


        /* Define the skin elements that should not be colorized.
           For text area, the skin itself is colorized but the individual parts are not. */
        static private const exclusions:Array = ["background", "scroller"];

        override public function get colorizeExclusions():Array {return exclusions;}

        /* Define the content fill items that should be colored by the "contentBackgroundColor" style. */
        static private const contentFill:Array = ["bgFill"];

        override public function get contentItems():Array {return contentFill};

    <!-- border -->
    <s:Rect left="0" right="0" top="0" bottom="0">
            <s:SolidColorStroke color="0x686868" weight="1"/>

    <!-- fill -->
    <!--- Defines the appearance of the TextArea component's background. -->
    <s:Rect id="background" left="1" right="1" top="1" bottom="1">
        <!--- Defines the background fill color. -->
            <s:SolidColor id="bgFill" color="0xFFFFFF" alpha="0.5" />

    <!-- shadow -->
    <s:Rect left="1" top="1" right="1" height="1">
            <s:SolidColor color="0x000000" alpha="0.12" />

    <!--- Defines the scroller used to scroll the RichEditableText. -->
    <s:Scroller id="scroller" left="0" top="0" right="0" bottom="0">
        <s:RichEditableText id="textView"
                  paddingLeft="4" paddingTop="4"
                  paddingRight="4" paddingBottom="4"/>



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.

2 thoughts on “Creating a transparent Spark TextArea control in Flex 4

  1. Hi Peter,

    I’m trying to use this example, but get different results (using sdk
    The width and height act very weird (not as in the example), do you have any idea why?

  2. There is simpler way to control “alpha” value of Spark TextArea’s background.

    Just set the value of “contentBackgroundAlpha” style on Spark TextArea to the desired value from 0 to 1.

    textArea.contentBackgroundAlpha = 0.5

Comments are closed.