AS3加载文件时的异常捕获

来源:互联网 发布:权知其意执肃手曰翻译 编辑:程序博客网 时间:2024/06/05 09:03
So you want to load an image (jpg or something else like a swf) using AS3 ( actionscript 3 ) and then return the error ( or do something else like show a default image ) if the image doesn’t exist.
/*code*/
import flash.net.URLLoader;
import flash.display.Loader;
import flash.events.*;
var i = new Loader();
i.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
i.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
i.load(new URLRequest(“http://www.kirupa.com/new_layout/modules/kirupaLogoGIF.gif”));
//change the url of the above line to something that doesn’t exist to test the error
movieClipInstance.addChild(i);
function errorHandler(event:ErrorEvent):void {
trace(“errorHandler: ” + event);
}
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(810) | 评论(0) | 转发(0) |
0

上一篇:从ie临时文件夹一次复制多个文件

下一篇:[AS3] LoaderContext 解决跨域加载

相关热门文章
  • ubuntu下idea的字体设置
  • ORA-600(15599)错误
  • 开源负载均衡LVS随机自启动异...
  • nginx default跳转
  • VS项目输出路径的理解...
  • 关于SSI
  • IP Sec VPN与NAT破镜重圆
  • JS模拟鼠标自动点击
  • UT2.0正式版下载
  • tomcat6.0配置(含配置视频下载...
  • linux dhcp peizhi roc
  • 关于Unix文件的软链接
  • 求教这个命令什么意思,我是新...
  • sed -e "/grep/d" 是什么意思...
  • 谁能够帮我解决LINUX 2.6 10...
给主人留下些什么吧!~~