Displaying an italic font style on a TextBox control in Flex Gumbo

The following example shows how you can specify an italic font style on a device and embedded font on a Flex Gumbo TextBox control by setting the fontStyle 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/2008/12/12/displaying-an-italic-font-style-on-a-textbox-control-in-flex-gumbo/ -->
<Application name="TextBox_fontStyle_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <Style>
        @font-face {
            src: url("C:/Windows/Fonts/ARIALI.TTF");
            fontFamily: "ArialEmbedded";
            fontStyle: "italic";
            cff: true;
        }
    </Style>

    <VGroup>
        <TextBox id="deviceTextBox"
                text="The quick brown fox jumps over the lazy dog. (device)"
                fontFamily="Arial"
                fontStyle="italic"
                fontLookup="device" />
        <TextBox id="embeddedCFFTextBox"
                text="The quick brown fox jumps over the lazy dog. (embeddedCFF)"
                fontFamily="ArialEmbedded"
                fontLookup="embeddedCFF"
                fontStyle="italic" />
    </VGroup>

</Application>

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.