
135
CHAPTER 8
Working with Text
A dynamic or input text field is a TextField object (an instance of the TextField class). When you
create a text field, you can assign it an instance name in the Property inspector. You can use the
instance name in ActionScript statements to set, change, and format the text field and its content
using the TextField and TextFormat classes.
The methods of the TextField class let you set, select, and manipulate text in a dynamic or input
text field that you create during authoring or at runtime. For more information, see
“Using the
TextField class” on page 135
. For information on debugging text fields at runtime, see
“Displaying text field properties for debugging” on page 78
.
ActionScript also provides several ways to format your text at runtime. The TextFormat class lets
you set character and paragraph formatting for TextField objects (see
“Using the TextFormat
class” on page 137
). Flash Player also supports a subset of HTML tags that you can use to format
text (see
“Using HTML-formatted text” on page 147
). Flash Player 7 and later supports the
<img>
HTML tag, which lets you embed not just external images, but also external SWF files, as
well as movie clips that reside in the library *see
“Image tag (<img>)” on page 149
).
In Flash Player 7 and later, you can apply Cascading Style Sheets (CSS) styles to text fields using
the TextField.StyleSheet class. You can use CSS to style built-in HTML tags, define new
formatting tags, or apply styles. For more information on using CSS, see
“Formatting text with
Cascading Style Sheets” on page 139
.
You can also assign HTML formatted text, which may optionally use CSS styles, directly to a text
field. In Flash Player 7 and later, HTML text that you assign to a text field can contain embedded
media (movie clips, SWF files, and JPEG files). The text will wrap around the embedded media,
just as a web browser wraps text around media embedded in an HTML document. For more
information, see
“Image tag (<img>)” on page 149
.
Using the TextField class
The TextField class represents any dynamic or selectable (editable) text field you create using the
Text tool in Flash. You use the methods and properties of this class to control text fields at
runtime. TextField objects support the same properties as MovieClip objects, with the exception
of the
_currentframe
,
_droptarget
,
_framesloaded
, and
_totalframes
properties. You can
get and set properties and invoke methods for text fields dynamically.
Содержание 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...