User Guide

886 Chapter 2: ActionScript Language Reference
TextField.getFontList()
Availability
Flash Player 6.
Usage
TextField.getFontList() : Array
Parameters
None.
Returns
An array.
Description
Method; a static method of the global Te xt Fie l d c la s s . You dont specify a specific text field (such
as
my_txt) when you call this method. This method returns names of fonts on the players host
system as an array. (It does not return names of all fonts in currently loaded SWF files.) The
names are of type String.
Example
The following code displays a font list returned by getFontList():
var font_array:Array = TextField.getFontList();
font_array.sort();
trace("You have "+font_array.length+" fonts currently installed");
trace("--------------------------------------");
for (var i = 0; i<font_array.length; i++) {
trace("Font #"+(i+1)+":\t"+font_array[i]);
}