MACROMEDIA FLASH 8-USING FLASH Use Manual page 188

Using flash
Table of Contents

Advertisement

6.
In the Object field, enter the name of the TextFormat object you created in step 3,
myformat. The following code appears in the Script pane:
mytext.setTextFormat(myformat);
For more information, see "Using the TextFormat class" in Learning ActionScript 2.0 in Flash.
Using text field events to trigger scripts
You can use ActionScript to capture events that happen to text fields—for example, you can
determine whether a user has changed or scrolled the text. You can write ActionScript
statements that use these events to trigger scripts to run.
You can capture the following text field events:
To use a text field event to trigger a script:
1.
Assign an instance name to the text field. Do one of the following:
Use the Text tool to create a text field on the Stage. Assign the text field an instance
name in the Property inspector.
Use ActionScript to create a text field dynamically with the
method. Assign the text field an instance name as a parameter of the
createTextField
2.
In the Actions panel, select the Built-in Classes category in the Actions toolbox, then select
the Movie category, then select the TextField category, and then select the Events category.
Finally, double-click an event. For this example, use the
3.
Replace the placeholder
4.
Add ActionScript statements inside the function. These statements run when the text field
is changed.
About using Cascading Style Sheets (CSS) with text
fields
You can attach style sheets to text fields to control text formatting. Flash supports a subset of
CSS tags. You attach a style sheet to a text file using the TextField.StyleSheet object. See
"Creating a style sheet object" in Learning ActionScript 2.0 in Flash.
188
Working with Text
onChanged
method.
with the actual instance name of the text field
instanceName
and
.
onScroller
createTextField
method.
onChanged
.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-USING FLASH and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF