Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1676337
  • 博文数量: 347
  • 博客积分: 9328
  • 博客等级: 中将
  • 技术积分: 2680
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-29 23:45
文章分类

全部博文(347)

文章存档

2016年(1)

2013年(4)

2012年(207)

2011年(85)

2010年(50)

分类: 系统运维

2012-04-16 13:53:53

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(“”));
//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);
}
阅读(1740) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~