Loading...
 
搜索
最新公告
Loading...
日 历
Loading...
最新日志
Loading...
最新评论
Loading...
最新留言
Loading...
统计信息
Loading...
友情链接




as3加载外部文件
[ 2008-4-4 16:46:00 ]
在as3中新增了 URLLoader 类

在as2中我们加载文本类型的用到 LoadVars ,加载xml用到 new XML() .
现在as3中 URLLoader 可以把这两种集中到一起来加载,加载到 event.currentTarget.data 然后进行分析

下面是一个例子

function loadStr(event:Event):void {
var url:String=inp.text;
var loadit:URLLoader = new URLLoader();
loadit.addEventListener(Event.COMPLETE, completeHandler);
loadit.load(new URLRequest(url));
}
function completeHandler(event:Event):void {
my_txt.htmlText = event.currentTarget.data as String;
}
bt.addEventListener(MouseEvent.CLICK, loadStr);

发表评论:

    昵称:
    主页:
    标题:
    Loading...
COPYRIGHT © 2007 StoneMX.Com ALL RIGHTS RESERVED.