Using HTML-formatted text
439
Font tag
The
<font>
tag specifies a font or list of fonts to display the text.
The font tag supports the following attributes:
■
color
Only hexadecimal color (
#FFFFFF
) values are supported. For example, the
following HTML code creates red text:
myText_txt.htmlText = "<font color='#FF0000'>This is red text</font>";
■
face
Specifies the name of the font to use. As shown in the following example, you can
specify a list of comma-delimited font names, in which case Flash Player selects the first
available font:
myText_txt.htmlText = "<font face='Times, Times New Roman'>Displays as
either Times or Times New Roman...</font>";
If the specified font is not installed on the user’s computer system or isn’t embedded in the
SWF file, Flash Player selects a substitute font.
For more information on embedding fonts in Flash applications, see embedFonts
(TextField.embedFonts property) in the
ActionScript 2.0 Language Reference
and
“Setting dynamic and input text options” in
Using Flash
.
■
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
The
<img>
tag lets you embed external image files (JPEG, GIF, PNG), SWF files, and movie
clips inside text fields and TextArea component instances. Text automatically flows around
images you embed in text fields or components. To use this tag, you must set your dynamic or
input text field to be multiline and to wrap 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 createTextField (MovieClip.createTextField
method), set the new text field instance’s multiline (TextField.multiline property)
and multiline (TextField.multiline property) properties to
true
.
The
<img>
tag has one required attribute,
src
, which specifies the path to an image file, a
SWF file, or the linkage identifier of a movie clip symbol in the library. All other attributes
are optional.
Summary of Contents for FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Page 1: ...Learning ActionScript 2 0 in Flash...
Page 8: ...8 Contents...
Page 18: ...18 Introduction...
Page 30: ...30 What s New in Flash 8 ActionScript...
Page 66: ...66 Writing and Editing ActionScript 2 0...
Page 328: ...328 Interfaces...
Page 350: ...350 Handling Events...
Page 590: ...590 Creating Interaction with ActionScript...
Page 710: ...710 Understanding Security...
Page 730: ...730 Debugging Applications...
Page 780: ...780 Deprecated Flash 4 operators...
Page 830: ...830 Index...