Embedding images, SWF files, and movie clips in text fields
In Flash Player 7 and later, you can use the
clips inside dynamic and input text fields. (For a full list of attributes for the
"Image tag (<img>)" on page
By default, Flash displays media embedded in a text field at full size. To specify dimensions for
embedded media, use the
width values" on page
In general, an image embedded in a text field appears on the line following the
However, when the
line of the text field.
Embedding SWF and JPEG files
To embed a JPEG or SWF file in a text field, specify the absolute or relative path to the JPEG or
SWF file in the
<img>
that's located in the same directory as the SWF file.
textField_txt.htmlText = "<p>Here's a picture from my last vacation:<img
src='beach.jpg'>";
Embedding movie clip symbols
To embed a movie clip symbol in a text field, you specify the symbol's linkage identifier for the
tag's
attribute. (For information on defining a linkage identifier, see
<img>
src
movie clip symbol to the Stage" on page
For example, the following code inserts a movie clip symbol with the linkage identifier
.
symbol_ID
textField_txt.htmlText = "<p>Here's a movie clip symbol:<img
src='symbol_ID'>";
In order for an embedded movie clip to display properly and completely, the registration point for
its symbol should be at point (0,0).
Specifying height and width values
If you specify
width
the JPEG file, SWF file, or movie clip. After a JPEG or SWF file has downloaded completely it is
displayed in the reserved space. Flash scales the media up or down according to the
values.
width
If you don't specify
a JPEG or SWF file has downloaded completely, Flash inserts it into the text field at full size and
rebreaks text around it.
Controlling embedded media with ActionScript
Flash Player creates a new movie clip for each
TextField object. The
that is created. This lets you control that movie clip with ActionScript.
The movie clip created by Flash Player is added as a child movie clip to the text field that contains
the image.
152
Chapter 8: Working with Text
149.)
tags's
<img>
height
152.)
tag is the first character in the text field, the image appears on the first
<img>
tag's
attribute. For example, the following code inserts a JPEG file
src
127.)
and
attributes for an
height
and
values, no space is reserved for the embedded media. After
height
width
tag's
attribute lets you assign an instance name to the movie clip
<img>
id
tag to embed JPEG files, SWF files, and movie
<img>
and
attributes. (See
width
tag, space is reserved in the text field for
<img>
tag and embeds that movie clip within the
<img>
tag, see
<img>
"Specifying height and
tag.
<img>
"Attaching a
and
height
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?