There are a variety of ways to manipulate text and HTML with Flash that allow you to expand the capabilities of your website. Adi Reddy Mora goes over some of the most common ones.
Working with Text and HTML in Flash - Formatting Text using HTML (Page 4 of 6 )
Flash Player supports a subset of standard HTML tags such as <b>, <p>and <li>that you can use to style text in any dynamic or input text field.
Flash Player also supports the <textformat>tag, which lets you apply paragraph formatting styles of the TextFormat class to HTML enabled text fields.
To use HTML in a text field, you must enable the text field’s HTML formatting either by selecting the Render Text as HTML option in the Property panel or by setting the text field’s htmlproperty to true using ActionScript. To insert HTML into a text field use the TextField.htmlTextproperty.
For example, the following code enables HTML formatting for a text field named sample _txtand then assigns some HTML to the text field using font tags.
sample_txt.html = true;
sample_txt.htmlText = "<font face = 'Times New Roman' size = '24' color = '#003366'> This is how you assign HTML text to a text field.</font>";
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 alignattribute ( left) is not enclosed in quotation marks:
sample_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 examples are acceptable:
sample_txt.htmlText = "<p align='left'>This uses single quotes</p>";
sample_txt.htmlText = "<p align=\"left\"> This uses escaped double 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.