beautypg.com

Fontitem.bold, Fontitem.font – Adobe Extending Flash Professional CS4 User Manual

Page 298

background image

276

EXTENDING FLASH CS4 PROFESSIONAL

fontItem object

fontItem.bold

Availability
Flash CS4 Professional.

Usage

fontItem.bold

Description
Property; a Boolean value that specifies whether the Font item is bold (

true

) or not (

false

).

Example
Assuming that the first item in the Library is a Font item, the following code displays

true

in the Output panel if it is

bold,

false

if it is not, and then sets it to bold.

var theItem = fl.getDocumentDOM().library.items[0];
fl.outputPanel.clear();
fl.trace("bold: "+ theItem.bold);
theItem.bold=true;
fl.trace("bold: "+ theItem.bold);

fontItem.font

Availability
Flash CS4 Professional.

Usage

fontItem.font

Description
Property; a string that specifies the name of the device font associated with the Font item. If you enter a string that does
not correspond to an installed device font, an error message is displayed. To determine if a font exists on the system,
use

fl.isFontInstalled()

.

Note: When you set this value, the resulting property value might be different from the string you enter. See the following
example.

Example
Assuming that the first item in the Library is a Font item, the following code displays the name of the device font
currently associated with the Font item, then changes it to Times:

fl.outputPanel.clear();
var theItem = fl.getDocumentDOM().library.items[0];
fl.trace(theItem.font);
theItem.font = "Times";
// depending on your system, the following may display something like "Times-Roman"
fl.trace(theItem.font);