EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Using the Textfield Class

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 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...
384 Working with Text and Strings
In Flash Player 7 and later, you can apply Cascading Style Sheet (CSS) styles to text fields
using the TextField.StyleSheet class. You can use CSS styles 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 Sheet styles” on page 421.
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). In Flash Player 8, you can also
dynamically load PNG, GIF, and progressive JPEG images (Flash Player 7 does not support
progressive JPEG images). The text wraps around the embedded media similar to how a web
browser wraps text around media embedded in an HTML document. For more information,
see “Image tag” on page 439.
For information on the terminology that compares text, strings, and more, see the
introduction for this chapter, “Working with Text and Strings” on page 381.
Using the TextField class
The TextField class represents any dynamic or input (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.
To use ActionScript to control a dynamic or input text field, you must assign the text field an
instance name in the Property inspector. You can then reference the text field with the
instance name, and use the methods and properties of the TextField class to control the
contents or basic appearance of the text field.
You can also create TextField objects at runtime, and assign them instance names, using the
MovieClip.createTextField() method. For more information, see “Creating text fields at
runtime” on page 387.
For more information on using the TextField class, see the following topics:
Assigning text to a text field at runtime” on page 385
About text field instance and variable names” on page 386
You can find sample source files that demonstrate how to work with text fields using
ActionScript. The source files are called textfieldsA.fla and textfieldsB.fla, and you can find
them in the Samples folder on your hard disk:
In Windows, browse to boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\TextFields.

Table of Contents

Related product manuals