For example, the following code embeds a SWF file named animation.swf in the text field named
textField_txt
contains the SWF file.
_level0.textField_txt.htmlText = "Here's an interesting animation: <img
src='animation.swf' id='animation_mc'>
In this case, the fully qualified path to the newly create movie clip is
_level0.textField_txt.animation_mc
button (on the same Timeline as
SWF file.
on(press) {
textField_txt.animation_mc.stop();
}
Making hyperlinks out of embedded media
To make a hyperlink out of an embedded JPEG file, SWF file, or movie clip, enclose the
tag in an
tag:
<a>
textField.htmlText = "Click the image to return home<a href='home.htm'><img
src='home.jpg'></a>";
When the mouse is over an image, SWF file, or movie clip that is enclosed by
pointer turns into a "hand" icon, just like standard hyperlinks. Interactivity, such as mouse clicks
and keypresses, do not register in SWF files and movie clips that are enclosed by
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 Mode option in the Text menu or the context menu, or
by Shift-double-clicking the text block handle.
You can use the
scrolling and the
block. The
scroll
positions, respectively; you can read and write these properties. The
properties specify the maximum vertical and horizontal scrolling positions, respectively; you can
only read these properties.
The TextArea component in Flash MX 2004 provides an easy way to create scrolling text fields
with a minimum of scripting. For more information, see the "TextArea component entry" in
Using Components Help.
To create a scrollable dynamic text block, do one of the following:
•
Shift-double-click the handle on the dynamic text block.
•
Select the dynamic text block with the Arrow tool, and select Text > Scrollable.
•
Select the dynamic text block with the Arrow tool. Right-click (Windows) or Control-click
(Macintosh) the dynamic text block, and select Text > Scrollable.
on level 0 and assigns the instance name
textField_txt
and
scroll
maxscroll
and
hscroll
maxhscroll
and
properties specify the current vertical and horizontal scrolling
hscroll
animation_mc
. For example, you could attach the following code to a
) that would stop the playhead of the embedded
properties of the TextField object to control vertical
properties to control horizontal scrolling in a text
to the movie clip that
<img>
tags, the mouse
<a>
tags.
<a>
and
maxscroll
maxhscroll
Creating scrolling text
153
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?
Questions and answers