zoukankan      html  css  js  c++  java
  • Embedding external files using [Embed]

    OK, I learnt this trick a few weeks ago from a co-worker. A user emailed me and asked if it was possible to embed an HTML/text file in a Flex application rather than having to load the files at runtime, similar to how you can embed images or whatnot.

    Not being certain, I asked the team and got this response…

    foobar.as

    package {
        import flash.utils.ByteArray;  

        [Embed(source="test.mxml", mimeType="application/octet-stream")]
        public class foobar extends ByteArray
        {
        }
    }

    test.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="testMe()">  

    <mx:Script>
        
    <![CDATA[
           public var myText:foobar = new foobar();
            public function testMe():void {
                trace(myText.toString());
            }
        
    ]]>
    </mx:Script>  

    </mx:Application>
  • 相关阅读:
    第一个爬虫和测试
    数学规律
    自定义手绘
    tqqqy的成绩表
    Linux常用命令-netstat
    文档查看命令 cat more less tail head
    Linux三剑客-常用命令
    IO多路复用模型
    redis 的线程模型
    为什么需要缓存?
  • 原文地址:https://www.cnblogs.com/taobataoma/p/1037021.html
Copyright © 2011-2022 走看看