Flash CS3 Documentation |
|||
| Learning ActionScript 2.0 in Adobe Flash > Working with Text and Strings > Using HTML-formatted text > About supported HTML entities | |||
HTML entities help you display certain characters in HTML formatted text fields, so that they are not interpreted as HTML. For example, you use less-than (<) and greater-than (>) characters to enclose HTML tags, such as <img> and <span>. To display less-than or greater-than characters in HTML-formatted text fields in Flash, you need to substitute HTML entities for those characters. The following ActionScript creates an HTML formatted text field on the Stage and uses HTML entities to display the string "<b>" without having the text appear in bold:
this.createTextField("my_txt", 10, 100, 100, 100, 19);
my_txt.autoSize = "left";
my_txt.html = true;
my_txt.htmlText = "The <b> tag makes text appear <b>bold</b>.";
At runtime, the previous code example in Flash displays the following text on the Stage:
The <b> tag makes text appear bold.
In addition to the greater-than and less-than symbols, Flash also recognizes other HTML entities that are listed in the following table.
|
Entity |
Description |
|---|---|
<
|
< (less than) |
>
|
> (greater than) |
&
|
& (ampersand) |
"
|
" (double quotes) |
'
|
' (apostrophe, single quote) |
Flash also supports explicit character codes, such as ' (ampersand - ASCII) and & (ampersand - Unicode).
The following ActionScript demonstrates how you can use ASCII or Unicode character codes to embed a tilde (~) character:
this.createTextField("my_txt", 10, 100, 100, 100, 19);
my_txt.autoSize = "left";
my_txt.html = true;
my_txt.htmlText = "~"; // tilde (ASCII)
my_txt.htmlText += "\t"
my_txt.htmlText += "~"; // tilde (Unicode)
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00000934.html