User Guide
Using HTML-formatted text 239
• size Specifies the size of the font, in pixels, as shown in the following example:
myText_txt.htmlText = "<font size=’24’ color=’#0000FF’>This is blue, 24-
point text</font>";
You can also use relative point sizes instead of a pixel size, such as +2 or -4.
Image tag (<img>)
The
<img> tag lets you embed external JPEG files, SWF files, and movie clips inside text fields
and TextArea component instances. Text automatically flows around images you embed in text
fields or components. This tag is supported only in dynamic and input text fields that are
multiline and wrap their text.
To create a multiline text field with word wrapping, do one of the following:
• In the Flash authoring environment, select a text field on the Stage and then, in the Property
inspector, select Multiline from the Text Type menu.
• For a text field created at runtime with MovieClip.createTextField(), set the new text field
instance’s
TextField.multiline and TextField.wordWrap properties to true.
The
<img> tag has one required attribute, src, which specifies the path to a JPEG file, a SWF file,
or the linkage identifier of a movie clip symbol in the library. All other attributes are optional.
The
<img> tags supports the following attributes:
• src Specifies the URL to a JPEG or SWF file, or the linkage identifier for a movie clip
symbol in the library. This attribute is required; all other attributes are optional. External files
(JPEG and SWF files) do not show until they have downloaded completely.
Note: Flash Player supports non-progressive JPEG files, but does not support progressive JPEG
files.
• id Specifies the name for the movie clip instance (created by Flash Player) that contains the
embedded JPEG file, SWF file, or movie clip. This is useful if you want to control the
embedded content with ActionScript.
• width The width of the image, SWF file, or movie clip being inserted, in pixels.
• height The height of the image, SWF file, or movie clip being inserted, in pixels.
• align Specifies the horizontal alignment of the embedded image within the text field. Valid
value are
left and right. The default value is left.
• hspace Specifies the amount of horizontal space that surrounds the image where no text
appears. The default value is 8.
• vspace Specifies the amount of vertical space that surrounds the image where no text
appears. The default value is 8.
For more information and examples of using the
<img> tag, see “Embedding images, SWF files,
and movie clips in text fields” on page 242.