Recipe 9.30. Retrieving a List of System Fonts


Problem

You want to retrieve a list of fonts on the user's system.

Solution

Use the static TextField.fontList property.

Discussion

When you want to use system fonts (rather than embedding the font or using a font group), first determine which fonts the user has installed. You can retrieve an array of system fonts on the user's computer with the TextField.fontList property.

trace(TextField.fontList);

Retrieving the list of available system fonts simply yields an array of strings. To apply a font to the text, you'll have to use one of the techniques discussed in Recipe 9.16.




ActionScript 3. 0 Cookbook
ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers
ISBN: 0596526954
EAN: 2147483647
Year: 2007
Pages: 351

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net