The following example shows how you can set the line height on a Flex Gumbo FxTextArea control by setting the lineHeight 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/2008/11/04/setting-the-line-height-on-an-fxtextarea-control-in-flex-gumbo/ -->
<FxApplication name="FxTextArea_lineHeight_test"
        xmlns="http://ns.adobe.com/mxml/2009">
    <layout>
        <VerticalLayout />
    </layout>

    <Script>
        <![CDATA[
            private function slider_change(evt:Event):void {
                lbl.text = fxTextArea.getStyle('lineHeight');
            }
        ]]>
    </Script>

    <VBox id="box"
            width="100%"
            height="100%"
            paddingLeft="10"
            paddingRight="10"
            paddingTop="10"
            paddingBottom="10">
        <Form styleName="plain">
            <FormItem label="lineHeight:"
                    direction="horizontal">
                <FxHSlider id="slider"
                        minimum="50"
                        maximum="400"
                        value="120"
                        liveDragging="true"
                        change="slider_change(event);" />
                <Label id="lbl" />
            </FormItem>
        </Form>

        <FxTextArea id="fxTextArea"
                lineHeight="{slider.value}%"
                textAlign="justify"
                width="100%"
                height="100%">
            <content><String source="data/lorem.txt" /></content>
        </FxTextArea>
    </VBox>

</FxApplication>

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.

 
Tagged with:
 
About The Author

Peter deHaan

Peter deHaan currently works for Adobe on the Flex SDK QA team. While not working on Flex, Flash, and ColdFusion applications, Peter enjoys making up bios and writing in 3rd person. Peter's rarely updated blog can be found at blogs.adobe.com/pdehaan/, actionscriptexamples.com, airexamples.com, and coldfusionexamples.com.

One Response to Setting the line height on an FxTextArea control in Flex Gumbo

  1. Tangent says:

    Would be nice to have a sample showing as well.

Leave a Reply

Your email address will not be published.

You may 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