flex actionScript读取文件示例代码
程序员文章站
2022-03-21 23:27:40
import flash.events.event;
import flash.net.urlloader;
import flash.net.urlre...
import flash.events.event; import flash.net.urlloader; import flash.net.urlrequest; import flash.net.urlvariables; public class txtloader { private var settxt:function = null; public function txtloader() { } public function loadtxt(filename:string, settxt:function):void { this.settxt = settxt; var urlrequest:urlrequest = new urlrequest(filename); var urlloader:urlloader = new urlloader(); urlloader.addeventlistener(event.complete, complete); urlloader.load(urlrequest); } private function complete(event:event):void { var urlloader:urlloader = event.currenttarget as urlloader; settxt.call(null, urlloader.data); } } -----------------调用的方法------------------------------------------------------------- new txtloader().loadtxt('readme.txt', function(txt:string):void { alert.show( txt); });
上一篇: 营销软文写作技巧:配图不是越多越好
下一篇: 一篇成功的软文怎么写?有什么好的技巧