beautypg.com

Document.setfillcolor() – Adobe Extending Flash Professional CS4 User Manual

Page 166

background image

144

EXTENDING FLASH CS4 PROFESSIONAL

Document object

Returns
A Boolean value:

true

if at least one text attribute property is changed;

false

otherwise.

Description
Method; sets the specified

textAttrs

property of the selected text items to the specified value. For a list of property

names and allowable values, see the Property summary table for the

TextAttrs object

. If the optional parameters are

not passed, the method sets the style of the currently selected text range, or the whole text field if no text is selected. If
only startIndex is passed, the method sets that character’s attributes. If startIndex and endIndex are passed, the method
sets the attributes on the characters starting from startIndex up to, but not including, endIndex. If paragraph styles are
specified, all the paragraphs that fall within the range are affected.

Example
The following examples set the

fillColor, italic, and bold

text attributes for the selected text items:

var success = fl.getDocumentDOM().setElementTextAttr("fillColor", "#00ff00");

var pass = fl.getDocumentDOM().setElementTextAttr("italic", true, 10);

var ok = fl.getDocumentDOM().setElementTextAttr("bold", true, 5, 15);

document.setFillColor()

Availability
Flash MX 2004.

Usage

document.setFillColor(color)

Parameters

color

The color of the fill, in one of the following formats:

A string in the format

"#RRGGBB"

or

"#RRGGBBAA"

A hexadecimal number in the format

0xRRGGBB

An integer that represents the decimal equivalent of a hexadecimal number

If set to

null

, no fill color is set, which is the same as setting the Fill color swatch in the user interface to no fill.

Returns
Nothing.

Description
Method; changes the fill color of the selection to the specified color. For information on changing the fill color in the
Tools panel and Property inspector, see

document.setCustomFill()

.

Example
The first three statements in the following example set the fill color using each of the different formats for specifying
color. The fourth statement sets the fill to no fill.