Setting the border alpha on a Spark Border container in Flex 4

In a previous example, “Setting the border color on a Spark Border container in Flex 4”, we saw how you could set the border color on a Spark Border container in Flex 4 by setting the borderColor style.

The following example shows how you can set the border alpha on a Spark Border container in Flex 4 by setting the borderAlpha style.

Full code after the jump.

The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see www.adobe.com/products/flex/. To download the latest nightly build of the Flex 4 SDK, see opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4.

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"?>
<!-- http://blog.flexexamples.com/2009/09/05/setting-the-border-alpha-on-a-spark-border-container-in-flex-4/ -->
<s:Application name="Spark_Border_borderAlpha_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">
    <s:controlBarContent>
        <mx:Form>
            <mx:FormItem label="borderAlpha:">
                <s:HSlider id="slider"
                        minimum="0.0"
                        maximum="1.0"
                        value="1.0"
                        snapInterval="0.1"
                        stepSize="0.1" />
            </mx:FormItem>
        </mx:Form>
    </s:controlBarContent>
    <s:controlBarLayout>
        <s:HorizontalLayout />
    </s:controlBarLayout>
 
    <s:Border id="brdr"
            borderAlpha="{slider.value}"
            borderColor="red"
            clipAndEnableScrolling="true"
            horizontalCenter="0" verticalCenter="0"
            width="90%" height="90%">
        <s:RichText fontSize="72" width="100%">
            <s:p>The quick brown fox jumps over the lazy dog.</s:p>
        </s:RichText>
    </s:Border>
 
</s:Application>

For more information on the Spark Border container, see the Spark Border specification on the Flex Open Source site.

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.