EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 444

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
444 Working with Text and Strings
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 &lt;b&gt; 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.
Flash also supports explicit character codes, such as
&#39; (ampersand - ASCII) and
&#x0026; (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 = "&#126;"; // tilde (ASCII)
my_txt.htmlText += "\t"
my_txt.htmlText += "&#x007E;"; // tilde (Unicode)
Entity Description
&lt;
< (less than)
&gt;
> (greater than)
&amp;
& (ampersand)
&quot;
" (double quotes)
&apos;
' (apostrophe, single quote)

Table of Contents

Related product manuals