MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 445

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

About embedding images, SWF files, and movie clips
in text fields
In Flash Player 7 and later, you can use the
PNG), SWF files, and movie clips inside dynamic and input text fields, and TextArea
component instances. (For a full list of attributes for the
on page
439.)
Flash displays media embedded in a text field at full size. To specify the dimensions of the
media you are embedding, use the
specifying height and width values" on page
In general, an image embedded in a text field appears on the line following the
However, when the
<img>
first line of the text field.
Embedding SWF and image files
To embed an image or SWF file in a text field, specify the absolute or relative path to the
image (GIF, JPEG, or PNG) or SWF file in the
following example inserts a GIF file that's located in the same directory as the SWF file (a
relative address, on or offline).
Embedding an image in a text field:
1.
Create a new Flash document, and save it as embedding.fla.
2.
Add the following ActionScript to Frame 1 of the main Timeline:
this.createTextField("image1_txt", 10, 50, 50, 450, 150);
image1_txt.html = true;
image1_txt.htmlText = "<p>Here's a picture from my vacation:<img
src='beach.gif'>";
The preceding code creates a new dynamic text field on the Stage, enables HTML
formatting, and adds some text and a local image to the text field.
3.
Add the following ActionScript below the code added in the previous step:
this.createTextField("image2_txt", 20, 50, 200, 400, 150);
image2_txt.html = true;
image2_txt.htmlText = "<p>Here's a picture from my garden:<img
src='http://www.helpexamples.com/flash/images/image2.jpg'>";
You can also insert an image by using an absolute address. The preceding code inserts a
JPEG file that's located in a directory that's on a server. The SWF file that contains this
code might be on your hard disk or on a server.
<img>
tag's
<img>
height
447.)
tag is the first character in the text field, the image appears on the
tag to embed image files (JPEG, GIF,
tag, see
<img>
and
attributes. (See
width
tag's
attribute. For example, the
<img>
src
Using HTML-formatted text
"Image tag"
"About
tag.
<img>
445

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents