Using HTML-formatted text 447
9. Select Control > Test Movie to test the Flash document.
About specifying height and width values
If you specify width and height attributes for an <img> tag, space is reserved in the text field
for the image file, SWF file, or movie clip. After an image or SWF file is downloaded
completely, it appears in the reserved space. Flash scales the media up or down, according to
the values you specify for
height and width. You must enter values for both the height and
width attributes to scale the image.
If you don’t specify values for
height and width, no space is reserved for the embedded
media. After an image 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 creates a new movie clip for each <img> tag and embeds that movie clip within the
TextField object. The
<img> tag’s id attribute lets you assign an instance name to the movie
clip that is created. This lets you control that movie clip with ActionScript.
The movie clip that Flash creates is added as a child movie clip to the text field that contains
the image.
For example, the following example embeds a SWF file in a text field.
To embed a SWF file in a text field:
1. Create a new Flash document.
2. Resize the document’s Stage size to 100 pixels by 100 pixels.
3. Use the Rectangle tool to draw a red square on the Stage.
4. Resize the square to 80 pixels by 80 pixels by using the Property inspector, and then move
the shape to the center of the Stage.
5. Select Frame 20 on the Timeline and then press F7 (Windows or Macintosh) to insert a
new blank keyframe.
6. Use the Oval tool to draw a blue circle on the Stage on Frame 20.
7. Resize the circle to 80 pixels by 80 pixels by using the Property inspector, and then move
it to the center of the Stage.
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.