Chapter 8. Text
Introduction
Flash MX introduces a rich ActionScript API for working with text in movies. Prior versions didn’t allow much more than being able to control the value displayed in manually created text fields.
The TextField class is
used
to create and manipulate text at runtime (though the text itself can
be created either at runtime or authoring time). Through methods and
properties of a text field you can alter text
visibility, change the position of the text within the movie, enable
user input, and much more. In addition, there are two
“helper”
classes—TextFormat
and
Selection—that play a supporting role.
TextFormat objects are used to apply formatting
options such as font, font size, indentation, and margins to
text fields. The Selection
object allows programmatic control over keyboard focus and is helpful
for selecting and deselecting text fields and
the text within them.
Text fields share similar
properties with
MovieClip and Button
objects to control an object’s position, rotation,
and visibility, plus others shown in Table 8-1
(for a complete list of TextField properties,
refer to the online help under Help
→ ActionScript Dictionary).
Table 8-1. TextField graphical display properties
|
Property |
Description |
|---|---|
|
|
x coordinate of the text field relative to its parent |
|
|
y coordinate of the text field relative to its parent |
|
|
Width of the text field in pixels |
|
|
Height of the text field in pixels |
|
|
Horizontal scale of the text ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access