13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Using the TextField class<br />

For more details about how to embed fonts in applications, see “Embedded fonts for dynamic or input text fields” in<br />

Using Flash.<br />

Embedding a font in Flex<br />

You can embed fonts in a Flex application in many ways, including:<br />

Using the [Embed] metadata tag in a script<br />

Using the @font-face style declaration<br />

Establish a class for the font and use the [Embed] tag to embed it.<br />

You can only embed TrueType fonts directly in a Flex application. Fonts in other formats, such as Type 1 Postscript<br />

fonts, can first be embedded in a SWF file using Flash Professional and th<strong>en</strong> that SWF file can be used in your Flex<br />

application. For more details about using embedded fonts from SWF files in Flex, see “Embedding fonts from SWF<br />

files” in Using Flex 4.<br />

More Help topics<br />

Embed fonts for consist<strong>en</strong>t text appearance<br />

Peter deHaan: Embedding fonts<br />

Divillysausages.com: AS3 Font embedding masterclass<br />

Controlling sharpness, thickness, and anti-aliasing<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

By default, Flash Player or AIR determines the settings for text display controls like sharpness, thickness, and antialiasing<br />

as text resizes, changes color, or is displayed on various backgrounds. In some cases, like wh<strong>en</strong> you have very<br />

small or very large text, or text on a variety of unique backgrounds, you might want to maintain control over these<br />

settings. You can override Flash Player or AIR settings using the flash.text.TextR<strong>en</strong>derer class and its associated<br />

classes, like the CSMSettings class. These classes give you precise control over the r<strong>en</strong>dering quality of embedded text.<br />

For more information about embedded fonts, see “Using embedded fonts” on page 384.<br />

Note: The flash.text.TextField.antiAliasType property must have the value AntiAliasType.ADVANCED in order<br />

for you to set the sharpness, thickness, or the gridFitType property, or to use the<br />

TextR<strong>en</strong>derer.setAdvancedAntiAliasingTable() method.<br />

The following example applies custom continuous stroke modulation (CSM) properties and formatting to displayed<br />

text using an embedded font called myFont. Wh<strong>en</strong> the user clicks the displayed text, Flash Player or Adobe AIR applies<br />

the custom settings:<br />

Last updated 6/6/2012<br />

385

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!