MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 386

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

To create an HTML-formatted text field:
Use one of the following two steps to enable HTML formatting for the text field:
Select a text field and click Render Text as HTML in the Property inspector.
Set the text field's
code sample).
To apply HTML formatting to a text field by using ActionScript, type the following
ActionScript on Frame 1 of the Timeline:
this.createTextField("headline_txt", this.getNextHighestDepth(), 100, 100,
300, 20);
headline_txt.html = true;
headline_txt.htmlText = "New articles available on <i>Developer Center</
i>.";
The preceding code dynamically creates a new text field, enables HTML formatting, and
displays the text "New articles available on Developer Center" on the Stage, with the word
"Developer Center" appearing in italics.
When you use HTML formatted text with a text field (not components) on the Stage, you
must assign the text to the text field's
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.
On the Macintosh, browse to Macintosh HD/Applications/Macromedia Flash 8/Samples
and Tutorials/Samples/ActionScript/TextFields.
About text field instance and variable names
In the Instance Name text box in the Property inspector, you must assign an instance name to
a text field to invoke methods and get and set properties on that text field.
In the Var text box in the Property inspector, you can assign a variable name to a dynamic or
input text field. You can then assign values to the variable. This is a deprecated functionality
that you might use when you create applications for older versions of Flash Player (such as
Flash Player 4). When you target newer players, target the text of a text field by using its
instance name and ActionScript.
386
Working with Text and Strings
property to
html
true
by using ActionScript (see the following
property instead of the text property.
htmlText

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents