E.4 Unrecognized Tags and Attributes

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Appendix E.  HTML Support in Text Fields

Like web browsers, Flash ignores tags and attributes it does not recognize. For example, if we assign the following value to an HTML text field in Flash:

<P>Please fill in and print this form</P> <FORM><INPUT TYPE="TEXT"></FORM> <P>Thank you!</P>

the output will be:

Please fill in and print this form
Thank you!

The FORM and INPUT elements are not supported by Flash, so both are ignored. Similarly, if we use container elements such as <TD>, the content is preserved but the markup is ignored. For example:

myTextField = "<TABLE><TR><TD>table cell text</TD></TR></TABLE>";

outputs the following line without table formatting:

table cell text

However, in Flash 5 and Flash 6, if a tag is not terminated, the entire text that follows is considered part of the tag and will not display on screen. For example, given the following assignment:

theField_txt.htmlText = "We all know that 5 < 20. That's obvious.";

Flash displays:

We all know that 5

To include a < character in an HTML text field, use the entity &lt; as follows:

theField_txt.htmlText = "We all know that 5 &lt; 20. That's obvious.";

Flash displays:

We all know that 5 < 20. That's obvious.

For more information on including HTML source code in an HTML text field, see:

http://moock.org/asdg/technotes/sourceInHtmlField/


    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net