04
Nov
08

Setting the line height on an FxTextArea control in Flex Gumbo

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.


1 Response to “Setting the line height on an FxTextArea control in Flex Gumbo”


  1. 1 Tangent Nov 5th, 2008 at 1:46 pm

    Would be nice to have a sample showing as well.

Leave a Reply

This blog is terrible at eating HTML tags. If you plan on posting code/XML, please escape your "<" characters as "&lt;" and your ">" characters as "&gt;".




Badge Farm

  • Powered by Redoable 1.2
  • Cornify
  • Feeds burnt by Feedburner
  • Feed