Flex中如何利用[Embed]嵌入扩展文件的例子

Download: foobar.as
  1. package {
  2.     import flash.utils.ByteArray
  3.  
  4.     [Embed(source="test.mxml", mimeType="application/octet-stream")]
  5.     public class foobar extends ByteArray
  6.     {
  7.     }
  8. }
Download: test.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="testMe()"
  3.  
  4. <mx:Script>
  5.     <![CDATA[
  6.        public var myText:foobar = new foobar();
  7.         public function testMe():void {
  8.             trace(myText.toString());
  9.         }
  10.     ]]>
  11. </mx:Script> 
  12.  
  13. </mx:Application>

你可能感兴趣的:(xml,Flex,Flash,Adobe)