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
into a dynamic text field with the instance name
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
appears in the reserved space. Flash scales the media up or down, according to the
values. You must enter both
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.
Note: If you are dynamically loading your images into a text field containing text, it is good practice to
specify the width and height of the original image so the text properly wraps around the space you
reserve for your image.
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.
For example, the following code embeds a SWF file named animation.swf in the text field named
on level 0 and assigns the instance name
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 created movie clip is
_level0.textField_txt.animation_mc
the previous code (on the same Timeline as
stops the playhead of the embedded SWF file:
stop_btn.onRelease = function() {
_level0.textField_txt.animation_mc.stop();
};
212.)
and
attributes for an
height
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
textField_txt
tag, space is reserved in the text field for
<img>
and
attributes to scale the image.
width
tag and embeds that movie clip within the
<img>
animation_mc
. For example, you could place the following code after
) for a button called stop_btn that
textField_txt
"Attaching a
.
height
to the movie clip that
Using HTML-formatted text
and
243
Need help?
Do you have a question about the FLASH MX 2004-USING ACTIONSCRIPT IN FLASH and is the answer not in the manual?
Questions and answers