[AS3]as3读取数据时触发的事件源代码
[AS3]as3读取数据时触发的事件总结
- package {
- import flash.display.Sprite;
- import flash.events.Event;
- import flash.events.HTTPStatusEvent;
- import flash.events.IOErrorEvent;
- import flash.events.ProgressEvent;
- import flash.events.SecurityErrorEvent;
- import flash.net.URLLoader;
- import flash.net.URLLoaderDataFormat;
- import flash.net.URLRequest;
- public class Sample0707 extends Sprite
- {
- public function Sample0707()
- {
- var loader:URLLoader = new URLLoader(new URLRequest("file.txt"));
- loader.dataFormat = URLLoaderDataFormat.VARIABLES;
- loader.addEventListener(Event.OPEN,onOpen);
- loader.addEventListener(HTTPStatusEvent.HTTP_STATUS,onHttpStatus);
- loader.addEventListener(IOErrorEvent.IO_ERROR,onIOError);
- loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,onSecurityError);
- loader.addEventListener(ProgressEvent.PROGRESS,onProgress);
- loader.addEventListener(Event.COMPLETE,onComplete);
- }
- private function onOpen(event:Event):void
- {
- trace("CuPlayer.com提示:开始下载");
- }
- private function onComplete(event:Event):void
- {
- trace("Load Complete");
- var loader:URLLoader = event.target as URLLoader;
- for(var str:String in loader.data)
- {
- trace(str + ":" + loader.data[str]);
- }
- }
- private function onProgress(event:ProgressEvent):void
- {
- trace("Loading……");
- }
- private function onHttpStatus(event:HTTPStatusEvent):void
- {
- trace("CuPlayer.com提示:http请求状态代码:" + event.status);
- }
- private function onIOError(event:IOErrorEvent):void
- {
- trace("CuPlayer.com提示:致命错误导致下载终止");
- }
- private function onSecurityError(event:SecurityErrorEvent):void
- {
- trace("CuPlayer.com提示:试图读取安全沙漏允许以外的域数据");
- }
- }
- }
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...