
Preserving rich text formatting
179
If you will publish your Flash document as Flash Player 5 or earlier, you can use the text field
variable to apply HTML tags to text fields.
The following HTML tags are supported by the
htmlText
property text fields:
a
,
b
,
font
color
,
font face
,
font size
,
i
,
p
, and
u
.
The following HTML attributes are supported in text fields:
leftmargin
,
rightmargin
,
align
,
indent
, and
leading
. To apply these attributes, use the TextFormat class or cascading
style sheets. For more information, see Chapter 12, “Working with Text and Strings,” in
Learning ActionScript 2.0 in Flash
and “TextFormat class” or “TextField.StyleSheet class” in
the
ActionScript 2.0 Language Reference
.
To use the text field instance name to preserve rich text formatting:
1.
Do one of the following to assign an instance name to the text field:
■
Use the Text tool to create a text field on the Stage. Assign the text field an instance
name in the Property inspector.
■
Use the ActionScript
createTextField
method to create a text field dynamically.
Assign the text field an instance name as a parameter of the
createTextField
method.
2.
Do one of the following:
■
Select the Render Text as HTML option in the Property inspector.
■
In the Actions panel, set the
html
property of the TextField object to
true
, as in
the following:
myInstanceName
.html = true;
3.
In the Actions panel, set the
htmlText
property to a value that includes HTML tags.
For example, if you have a dynamic text field on the Stage with the instance name
instName
, the following code renders the text in bold:
myInstanceName
.htmlText = "<b>Chris</b>";
To use the text field variable to preserve rich text formatting:
1.
Select a text field on the Stage.
2.
Assign the text field a variable name in the Property inspector.
3.
Do one of the following:
■
Select the Render Text as HTML option in the Property inspector.
■
In the Actions panel, set the
html
property of the TextField object to
true
.
Summary of Contents for FLASH 8-FLASH
Page 1: ...Using Flash ...
Page 12: ...12 Contents ...
Page 110: ...110 Using Symbols Instances and Library Assets ...
Page 128: ...128 Working with Color Strokes and Fills ...
Page 156: ...156 Drawing ...
Page 190: ...190 Working with Text ...
Page 224: ...224 Working with Graphic Objects ...
Page 270: ...270 Creating Motion ...
Page 310: ...310 Working with Video ...
Page 362: ...362 Working with Screens Flash Professional Only ...
Page 386: ...386 Creating Multilanguage Text ...
Page 454: ...454 Data Integration Flash Professional Only ...
Page 500: ...500 Publishing ...
Page 534: ...534 Creating Accessible Content ...