Embedding external files using [Embed]

简介:
Posted on  2008-01-13 15:10  OldHawk 阅读( 313) 评论( 0编辑  收藏

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 >

    本文转自 OldHawk  博客园博客,原文链接:http://www.cnblogs.com/taobataoma/archive/2008/01/13/1037021.html ,如需转载请自行联系原作者



相关文章
|
Python
Python模块和包的基本使用
Python模块和包的基本使用
240 0
|
8天前
|
数据采集 人工智能 安全
|
4天前
|
机器学习/深度学习 人工智能 前端开发
构建AI智能体:七十、小树成林,聚沙成塔:随机森林与大模型的协同进化
随机森林是一种基于决策树的集成学习算法,通过构建多棵决策树并结合它们的预测结果来提高准确性和稳定性。其核心思想包括两个随机性:Bootstrap采样(每棵树使用不同的训练子集)和特征随机选择(每棵树分裂时只考虑部分特征)。这种方法能有效处理大规模高维数据,避免过拟合,并评估特征重要性。随机森林的超参数如树的数量、最大深度等可通过网格搜索优化。该算法兼具强大预测能力和工程化优势,是机器学习中的常用基础模型。
298 164
|
3天前
|
机器学习/深度学习 自然语言处理 机器人
阿里云百炼大模型赋能|打造企业级电话智能体与智能呼叫中心完整方案
畅信达基于阿里云百炼大模型推出MVB2000V5智能呼叫中心方案,融合LLM与MRCP+WebSocket技术,实现语音识别率超95%、低延迟交互。通过电话智能体与座席助手协同,自动化处理80%咨询,降本增效显著,适配金融、电商、医疗等多行业场景。
307 155