CHAPTER 9
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
221. For information on debugging text fields at runtime, see
"Displaying text field properties for debugging" on page
164.
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
224). Flash Player also supports a subset of HTML tags that you can use to format
text (see
"Using HTML-formatted text" on page
236). Flash Player 7 and later supports the
HTML tag, which lets you embed not just external images but also external SWF files as
<img>
well as movie clips that reside in the library (see
"Image tag (<img>)" on page
239).
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
226.
You can also assign HTML formatted text, which might 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 wraps around the embedded
media in the same way that a web browser wraps text around media embedded in an HTML
document. For more information, see
"Image tag (<img>)" on page
239.
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
,
,
, and
properties. You can
_currentframe
_droptarget
_framesloaded
_totalframes
get and set properties and invoke methods for text fields dynamically.
221
Need help?
Do you have a question about the FLASH MX 2004-USING ACTIONSCRIPT IN FLASH and is the answer not in the manual?