Jan 26, 2008

Here-document in AS3.0

Here-document is not implemented in AS3... But we can realize it using E4X and CDATA section!!

  1. var s:String = <><![CDATA[bar
  2. foo
  3. <p class="test">Any text here</p>
  4.  
  5. Ohhhhhhh!!!!!
  6. ]]></>;
  7.  
  8.     trace(s);
  9. /*
  10. bar
  11. foo
  12. <p class="test">Any text here</p>
  13.  
  14. Ohhhhhhh!!!!!
  15. */

You don't have to escape " and \ in the here-document.