Using special characters

Special characters are any characters that might confuse the XML parser. The contents of <mx:Script> tags are treated as XML by Flex. As a result, blocks of ActionScript should be wrapped in a CDATA construct so that Flex does not try to interpret special characters. The following example shows a CDATA construct:

<![CDATA[
   ...
]]>

Flex does not parse text in a CDATA construct so that you can use XML-parsed characters such as angle brackets (< and >) and ampersand (&). For example, the following script that includes a less than (<) comparison must be in a CDATA construct:

<mx:Script>
   <![CDATA[
   function changeText() {
      var x:Number = 1;
      if (x<3) {
         ta1.text = "Hello world";
      }
   } 
   ]]>
</mx:Script>

Version 1.5

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flex/15/flex_docs_en/00000055.htm