702
Chapter 12: ActionScript Dictionary
TextField.setTextFormat()
Availability
Flash Player 6.
Usage
my_txt
.setTextFormat (
textFormat
)
my_txt
.setTextFormat (
index
,
textFormat
)
my_txt
.setTextFormat (
beginIndex
,
endIndex
,
textFormat
)
Parameters
textFormat
A TextFormat object, which contains character and paragraph formatting
information.
index
An integer that specifies a character within
my_txt
.
beginIndex
An integer.
endIndex
An integer that specifies the first character after the desired text span.
Returns
Nothing.
Description
Method; sets a TextFormat object for a specified range of text in a text field. You can assign each
character in a text field a text format. The text format of the first character of a paragraph is
examined to perform paragraph formatting for the entire paragraph. The
setTextFormat()
method changes the text format applied to individual characters, to groups of characters, or to the
entire body of text in a text field.
The text format is set in a new TextFormat object. It contains both character and paragraph
formatting information. Character formatting information describes the appearance of individual
characters, for example, font name, point size, color, and associated URL. Paragraph formatting
information describes the appearance of a paragraph, for example, left margin, right margin,
indentation of the first line, and left, right, and center alignment.
Usage 1: Applies the properties of
textFormat
to all text in the text field.
Usage 2: Applies the properties of
textFormat
to the character at position
index
.
Usage 3: Applies the properties of the
textFormat
parameter to the span of text from the
beginIndex
parameter to the
endIndex
parameter.
Notice that any text inserted manually by the user, or replaced by means of
TextField.replaceSel()
, does not assume the formatting specified in a call to
setTextFormat()
. To set the default formatting for a TextField object, use
TextField.setNewTextFormat()
.
Example
This example creates a new TextFormat object called
myTextFormat
and sets its
bold
property to
true
. It then calls
setTextFormat()
and applies the new text format to the
my_txt
text field.
myTextFormat = new TextFormat();
myTextFormat.bold = true;
my_txt.setTextFormat(myTextFormat);
Содержание FLASH MX 2004 - ACTIONSCRIPT
Страница 1: ...ActionScript Reference Guide...
Страница 8: ...8 Contents...
Страница 12: ......
Страница 24: ...24 Chapter 1 What s New in Flash MX 2004 ActionScript...
Страница 54: ...54 Chapter 2 ActionScript Basics...
Страница 80: ...80 Chapter 3 Writing and Debugging Scripts...
Страница 82: ......
Страница 110: ...110 Chapter 5 Creating Interaction with ActionScript...
Страница 112: ......
Страница 120: ...120 Chapter 6 Using the Built In Classes...
Страница 176: ......
Страница 192: ...192 Chapter 10 Working with External Data...
Страница 202: ...202 Chapter 11 Working with External Media...
Страница 204: ......
Страница 782: ...782 Chapter 12 ActionScript Dictionary...
Страница 793: ...Other keys 793 221 222 Key Key code...
Страница 794: ...794 Appendix C Keyboard Keys and Key Code Values...
Страница 798: ...798 Appendix D Writing Scripts for Earlier Versions of Flash Player...
Страница 806: ...806 Appendix E Object Oriented Programming with ActionScript 1...
Страница 816: ...816 Index...