Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu Flash JavaScript Dictionary- P4 ppt
MIỄN PHÍ
Số trang
86
Kích thước
309.2 KB
Định dạng
PDF
Lượt xem
1663

Tài liệu Flash JavaScript Dictionary- P4 ppt

Nội dung xem thử

Mô tả chi tiết

TextAttrs object 301

This property applies only to static text; it generates a warning if used with other text types.

Example

The following example selects the characters from index 2 up to, but not including, index 6 and

sets the autoKern property to true:

fl.getDocumentDOM().setTextSelection(3, 6);

fl.getDocumentDOM().setElementTextAttr('autoKern', true);

textAttrs.bold

Availability

Flash MX 2004.

Usage

textAttrs.bold

Description

Property; a Boolean value. A value of true causes text to appear with the bold version of the font.

Example

The following example selects the first character of the selected text object and sets the bold

property to true:

fl.getDocumentDOM().setTextSelection(0, 1);

fl.getDocumentDOM().setElementTextAttr('bold', true);

textAttrs.characterPosition

Availability

Flash MX 2004.

Usage

textAttrs.characterPosition

Description

Property; a string that determines the baseline for the text. Acceptable values are "normal",

"subscript", and "superscript". This property applies only to static text.

Example

The following example selects the characters from index 2 up to, but not including, index 6 of the

selected text field and sets the characterPosition property to "subscript":

fl.getDocumentDOM().setTextSelection(2, 6);

fl.getDocumentDOM().setElementTextAttr("characterPosition", "subscript");

302 Chapter 3: Objects

textAttrs.characterSpacing

Availability

Flash MX 2004.

Usage

textAttrs.characterSpacing

Description

Property; an integer that represents the space between characters. Acceptable values are -60

through 60.

This property applies only to static text; it generates a warning if used with other text types.

Example

The following example sets the character spacing of the selected text field to 10:

fl.getDocumentDOM().setElementTextAttr("characterSpacing", 10);

textAttrs.face

Availability

Flash MX 2004.

Usage

textAttrs.face

Description

Property; a string that represents the name of the font, such as "Arial".

Example

The following example sets the font of the selected text field from the character at index 2 up to,

but not including, the character at index 8 to "Arial":

fl.getDocumentDOM().selection[0].setTextAttr("face", "Arial", 2, 8);

textAttrs.fillColor

Availability

Flash MX 2004.

Usage

textAttrs.fillColor

Description

Property; a string that specifies the fill color. The parameter is a color string in hexadecimal

#rrggbb format (where r is red, g is green, and b is blue), a hexidecimal color value (such as,

0xff0000), or an integer color value.

TextAttrs object 303

Example

The following example sets the color of the selected text field from the character at index 2 up to,

but not including, the character at index 8 to red:

fl.getDocumentDOM().selection[0].setTextAttr("fillColor", 0xff0000, 2, 8);

textAttrs.indent

Availability

Flash MX 2004.

Usage

textAttrs.indent

Description

Property; an integer that specifies paragraph indentation. Acceptable values are -720 through 720.

Example

The following example sets the indentation of the selected text field from the character at index 2

up to, but not including, the character at index 8 to 100. This can affect characters outside the

specified range if they are in the same paragraph.

fl.getDocumentDOM().selection[0].setTextAttr("indent", 100, 2, 8);

textAttrs.italic

Availability

Flash MX 2004.

Usage

textAttrs.italic

Description

Property; a Boolean value. A value of true causes text to appear with the italic version of the font.

Example

The following example sets the selected text field to italic:

fl.getDocumentDOM().selection[0].setTextAttr("italic", true);

textAttrs.leftMargin

Availability

Flash MX 2004.

Usage

textAttrs.leftMargin

304 Chapter 3: Objects

Description

Property; an integer that specifies the paragraph’s left margin. Acceptable values are 0 through

720.

Example

The following example sets the leftMargin property of the selected text field from the character

at index 2 up to, but not including, the character at index 8 to 100. This can affect characters

outside the specified range if they are in the same paragraph.

fl.getDocumentDOM().selection[0].setTextAttr("leftMargin", 100, 2, 8);

textAttrs.lineSpacing

Availability

Flash MX 2004.

Usage

textAttrs.lineSpacing

Description

Property; an integer that specifies the line spacing (leading) of the paragraph. Acceptable values

are -360 through 720.

Example

The following example sets the selected text field’s lineSpacing property to 100:

fl.getDocumentDOM().selection[0].setTextAttr("lineSpacing", 100);

textAttrs.rightMargin

Availability

Flash MX 2004.

Usage

textAttrs.rightMargin

Description

Property; an integer that specifies the paragraph’s right margin. Acceptable values are 0 through

720.

Example

The following example sets the rightMargin property of the selected text field from the character

at index 2 up to, but not including, the character at index 8 to 100. This can affect characters

outside the specified range if they are in the same paragraph.

fl.getDocumentDOM().selection[0].setTextAttr("rightMargin", 100, 2, 8);

TextAttrs object 305

textAttrs.rotation

Availability

Flash MX 2004.

Usage

textAttrs.rotation

Description

Property; a Boolean value. A value of true causes Flash to rotate the characters of the text 90º.

The default value is false. This property applies only to static text with a vertical orientation; it

generates a warning if used with other text types.

Example

The following example sets the rotation of the selected text field to true:

fl.getDocumentDOM().setElementTextAttr("rotation", true);

textAttrs.size

Availability

Flash MX 2004.

Usage

textAttrs.size

Description

Property; an integer that specifies the size of the font.

Example

The following example retrieves the size of the character at index 2 and shows the result in the

Output panel:

fl.outputPanel.trace(fl.getDocumentDOM().selection[0].getTextAttr("size", 2));

textAttrs.target

Availability

Flash MX 2004.

Usage

textAttrs.target

Description

Property; a string that represents the target property of the text field. This property works only

with static text.

306 Chapter 3: Objects

Example

The following example gets the target property of the text field in the first frame of the top layer

of the current scene and shows it in the Output panel:

fl.outputPanel.trace(fl.getDocumentDOM().getTimeline().layers[0].frames[0].ele

ments[0].getTextAttr("target"));

textAttrs.url

Availability

Flash MX 2004.

Usage

textAttrs.url

Description

Property; a string that represents the URL property of the text field. This property works only with

static text.

Example

The following example sets the URL of the selected text field to http://www.macromedia.com:

fl.getDocumentDOM().setElementTextAttr("url", "http://www.macromedia.com");

Text object 307

Text object

Inheritance Element object > Text object

Availability

Flash MX 2004.

Description

The Text object represents a single text item in a document. All properties of the text pertain to

the entire text block.

To set properties of a text run within the text field, see “Property summary for the TextRun

object” on page 322. To change properties of a selection within a text field, you can use

document.setElementTextAttr() and specify a range of text, or use the current selection.

To set text properties of the selected text field, use document.setElementProperty(). The

following example assigns the currently selected text field to the variable textVar:

fl.getDocumentDOM().setElementProperty("variableName", "textVar");

Method summary for the Text object

In addition to the Element object methods, you can use the following methods with the

Text object:

Property summary for the Text object

In addition to the Element object properties, the following properties are available for the

Text object:

Method Description

text.getTextAttr() Method; retrieves the specified attribute for the text identified by the

optional startIndex and endIndex parameters.

text.getTextString() Method; retrieves the specified range of text.

text.setTextAttr() Method; sets the specified attribute associated with the text identified by

startIndex and endIndex.

text.setTextString() Method; changes the text string within this text object.

Property Description

text.accName Property; a string that is equivalent to the Name field in the Accessibility

panel.

text.autoExpand Property; a Boolean value that controls the expansion of the bounding

width for static text fields or the bounding width and height for dynamic

or input text.

text.border Property; a Boolean value that controls whether Flash shows (true) or

hides (false) a border around dynamic or input text.

text.description Property; a string that is equivalent to the Description field in the

Accessibility panel.

CHAPTER 3

Objects

308 Chapter 3: Objects

text.accName

Availability

Flash MX 2004.

Usage

text.accName

text.embeddedCharacters Property; a string that specifies characters to embed. This is equivalent

to entering text in the Character Options dialog box.

text.embedRanges Property; a string that consists of delimited integers that correspond to

the items that can be selected in the Character Options dialog box.

text.length Read-only; an integer that represents the number of characters in the

text object.

text.lineType Property; a string that sets the line type to "single line", "multiline",

"multiline no wrap", or "password".

text.maxCharacters Property; an integer that specifies the maximum characters the user can

enter into this text object.

text.orientation Property; a string that specifies the orientation of the text field.

text.renderAsHTML Property; a Boolean value that controls whether Flash draws the text as

HTML and interprets embedded HTML tags.

text.scrollable Property; a Boolean value that controls whether the text can (true) or

cannot (false) be scrolled.

text.selectable Property; a Boolean value that controls whether the text can (true) or

cannot (false) be selected. Input text is always selectable.

text.selectionEnd Property; a zero-based integer that specifies the offset of the end of a

text subselection.

text.selectionStart Property; a zero-based integer that specifies the offset of the beginning

of a text subselection.

text.shortcut Property; a string that is equivalent to the Shortcut field in the

Accessibility panel.

text.silent Property; a Boolean value that specifies whether the object is accessible.

text.tabIndex Property; an integer that is equivalent to the Tab Index field in the

Accessibility panel.

text.textRuns Read-only; an array of TextRun objects.

text.textType Property; a string that specifies the type of text field. Acceptable values

are "static", "dynamic", and "input".

text.useDeviceFonts Property; a Boolean value. A value of true causes Flash to draw text

using device fonts.

text.variableName Property; a string that contains the contents of the text object.

Property Description

Tải ngay đi em, còn do dự, trời tối mất!