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

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

    <VGroup>
        <TextBox id="deviceTextBox"
                text="The quick brown fox jumps over the lazy dog. (device)"
                fontFamily="Arial"
                fontWeight="bold"
                fontLookup="device" />

        <TextBox id="embeddedCFFTextBox"
                text="The quick brown fox jumps over the lazy dog. (embeddedCFF)"
                fontFamily="ArialEmbedded"
                fontWeight="bold"
                fontLookup="embeddedCFF"/>
    </VGroup>

</Application>
 
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.

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