To render HTML correctly, you must use the correct syntax. Attributes of HTML tags must
be enclosed in double (") or single (') quotation marks. Attribute values without quotation
marks can produce unexpected results, such as improper rendering of text. For example, the
following HTML snippet cannot be rendered properly by Flash Player because the value
assigned to the
align
this.createTextField("myField_txt", 10, 10, 10, 400, 200);
myField_txt.html = true;
myField_txt.htmlText = "<p align=left>This is left-aligned text</p>";
If you enclose attribute values in double quotation marks, you must escape the quotation
marks (
). Either of the following ways of doing this is acceptable:
\"
myField_txt.htmlText = "<p align='left'>This uses single quotes</p>";
myField_txt.htmlText = "<p align=\"left\">This uses escaped double quotes</
p>";
myField_txt.htmlText = '<p align="left">This uses outer single quotes</p>';
myField_txt.htmlText = '<p align=\'left\'>This uses escaped single quotes</
p>';
It's not necessary to escape double quotation marks if you're loading text from an external file;
it's necessary only if you're assigning a string of text in ActionScript.
About supported HTML tags
This section lists the built-in HTML tags that Flash Player supports. You can also create new
styles and tags by using CSS; see
on page
421.
For more information on supported HTML tags, see the following topics:
"Anchor tag" on page 438
"Bold tag" on page 438
"Break tag" on page 438
"Font tag" on page 439
"Image tag" on page 439
"Italic tag" on page 440
"List item tag" on page 440
"Paragraph tag" on page 441
"Span tag" on page 441
"Text format tag" on page 442
"Underline tag" on page 443
attribute (
) is not enclosed in quotation marks:
left
"Formatting text with Cascading Style Sheet styles"
Using HTML-formatted text
437
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?