EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - CHAPTER 8 Working with Text

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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.

Table of Contents

Related product manuals