186
Working with Text
To set text field properties dynamically:
1.
Select Window > Actions to open the Actions panel if it isn’t already open.
2.
Do one of the following to create a text field:
■
Select the Text tool and create a text field on the Stage. Assign the text field an instance
name in the Property inspector. For this example, enter the instance name
myText
.
■
Double-click the
createTextField
method of the MovieClip object in the Actions
toolbox to add it to the Script pane in the Actions panel. See
“Creating text”
on page 162
. For this example, enter the instance name
myText
as a parameter of the
createTextField
method.
3.
Do one of the following to place text in the text field:
■
Enter text into the text field on the Stage.
■
Set the
text
property of the TextField object. See
“Creating text” on page 162
.
4.
In the Actions toolbox, select the Built-in Classes category, then select the Movie category,
then select the TextField category, and then select the Properties category. Finally, double-
click the
multiline
property.
5.
Enter the following parameters:
■
Object
is the instance name of the text field whose property you want to set.
■
Value
is the value of the property.
6.
Repeat steps 4 and 5 for the
wordWrap
and
border
properties. The following code appears
in the Script pane:
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = true;
For a complete list of TextField object methods and detailed descriptions of each, see
TextField in
ActionScript 2.0 Language Reference
.
Formatting text dynamically
You can use the ActionScript TextFormat object to set properties of a text field. A TextFormat
object incorporates character and paragraph formatting information. Character formatting
information describes the appearance of individual characters: font name, point size, color,
and an associated URL. Paragraph formatting information describes the appearance of a
paragraph: left margin, right margin, indention of the first line, and left, right, or center
alignment.
Содержание FLASH 8-FLASH
Страница 1: ...Using Flash ...
Страница 12: ...12 Contents ...
Страница 110: ...110 Using Symbols Instances and Library Assets ...
Страница 128: ...128 Working with Color Strokes and Fills ...
Страница 156: ...156 Drawing ...
Страница 190: ...190 Working with Text ...
Страница 224: ...224 Working with Graphic Objects ...
Страница 270: ...270 Creating Motion ...
Страница 310: ...310 Working with Video ...
Страница 362: ...362 Working with Screens Flash Professional Only ...
Страница 386: ...386 Creating Multilanguage Text ...
Страница 454: ...454 Data Integration Flash Professional Only ...
Страница 500: ...500 Publishing ...
Страница 534: ...534 Creating Accessible Content ...