Creating drop shadows on the Flex TextArea control

by Peter deHaan on September 23, 2007

in TextArea

The following example shows how you can control the drop shadow on a Flex TextArea control using the dropShadowColor, shadowDirection, and shadowDistance styles.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/09/23/creating-drop-shadows-on-the-flex-textarea-control/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:ApplicationControlBar dock="true">
        <mx:Form>
            <mx:FormItem label="dropShadowEnabled:">
                <mx:CheckBox id="checkBox" selected="true" />
            </mx:FormItem>
            <mx:FormItem label="dropShadowColor:">
                <mx:ColorPicker id="colorPicker" />
            </mx:FormItem>
            <mx:FormItem label="shadowDirection:">
                <mx:ComboBox id="comboBox" selectedIndex="1">
                    <mx:dataProvider>
                        <mx:Array>
                            <mx:Object label="left" />
                            <mx:Object label="center" />
                            <mx:Object label="right" />
                        </mx:Array>
                    </mx:dataProvider>
                </mx:ComboBox>
            </mx:FormItem>
            <mx:FormItem label="shadowDistance:">
                <mx:HSlider id="slider"
                        minimum="-10"
                        maximum="10"
                        value="0"
                        labels="[-10,-5,0,5,10]"
                        liveDragging="true"
                        snapInterval="1"
                        tickInterval="2" />
            </mx:FormItem>
        </mx:Form>
    </mx:ApplicationControlBar>

    <mx:TextArea id="textArea"
            dropShadowEnabled="{checkBox.selected}"
            dropShadowColor="{colorPicker.selectedColor}"
            shadowDistance="{slider.value}"
            shadowDirection="{comboBox.selectedItem.label}"
            width="320"
            height="120" />

</mx:Application>

View source is enabled in the following example.

Leave a Comment

Sorry, this blog is terrible at eating HTML comments.
If you're pasting any HTML/XML/MXML code, you need to convert your < characters to &lt; and your > characters to &gt; .

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree

Previous post:

Next post: