User Guide
244 Chapter 9: Working with Text
Making hypertext links out of embedded media
To make a hypertext link out of an embedded JPEG file, SWF file, or movie clip, enclose the
<img> tag in an <a> tag:
textField.htmlText = "Click the image to return home<a href='home.htm'><img
src='home.jpg'></a>";
When the mouse pointer is over an image, SWF file, or movie clip that is enclosed by <a> tags,
the pointer turns into a “pointing hand” icon, the same as it does with standard hypertext links.
Interactivity, such as mouse clicks and keypresses, does not register in SWF files and movie clips
that are enclosed by
<a> tags.
Creating scrolling text
There are several ways to create scrolling text in Flash. You can make dynamic and input text
fields scrollable by selecting the Scrollable option in the Text menu or the context menu, or by
Shift-double-clicking the text field handle.
You can use the
scroll and maxscroll properties of the TextField object to control vertical
scrolling and the
hscroll and maxhscroll properties to control horizontal scrolling in a text
block. The
scroll and hscroll properties specify the current vertical and horizontal scrolling
positions, respectively; you can read and write these properties. The
maxscroll and maxhscroll
properties specify the maximum vertical and horizontal scrolling positions, respectively; you can
only read these properties.
The TextArea component provides an easy way to create scrolling text fields with a minimum
amount of scripting. For more information, see “TextArea class” in Using Components.
To create a scrollable dynamic text block:
Do one of the following:
• Shift-double-click the handle on the dynamic text field.
• Select the dynamic text field with the Selection tool, and select Text > Scrollable.
• Select the dynamic text field with the Selection tool. Right-click (Windows) or Control-click
(Macintosh) the dynamic text field, and select Text > Scrollable.
To use the scroll property to create scrolling text:
1.
Do one of the following:
■ Use the Text tool to drag a text field on the Stage. Assign the text field the instance name
textField_txt in the Property inspector.
■ Use ActionScript to create a text field dynamically with the
MovieClip.createTextField() method. Assign the text field the instance name
textField_txt as a parameter of the method.
Note: If you are not dynamically loading text into the SWF file, select Text > Scrollable from the
main menu.