E.3 Quoting Attribute Values

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

Outside of Flash, HTML attribute values can be quoted with single quotes, double quotes, or no quotes at all. The following tags are all valid in most web browsers:

<P ALIGN=RIGHT> <P ALIGN='RIGHT'> <P ALIGN="RIGHT">

But in Flash, unquoted attribute values are not allowed. For example, the syntax <P ALIGN=RIGHT> is illegal in Flash. However, both single and double quotes can be used to delimit attribute values. When composing text field values that include HTML attributes, we must be careful to quote attributes correctly, using one type of quote to demarcate the string itself and another to demarcate attribute values. For example:

// These examples are both valid. myText = "<P ALIGN='RIGHT'>hi there</P>"; myText = '<P ALIGN="RIGHT">hi there</P>'; // This example causes an error because double quotation marks are // used to demarcate both the string and the attribute. myText = "<P ALIGN="RIGHT">hi there</P>";

For more information on using quotation marks to form strings, see Section 4.5.2.



    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