- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何处理\捕获这个错误
Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type.
我尝试使用 AS3 将损坏的图像加载到 MovieClip 中我尝试使用 try & catch 但没办法我也尝试添加 EventListener
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
但它没有捕获到这个错误
有什么帮助吗?!
最佳答案
如果你想捕获任何看不见的错误,你可以使用标准的 try-catch block 。
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener("complete", ldrDone);
ldr.contentLoaderInfo.addEventListener("ioError", ldrError);
ldr.load(new URLRequest("FILE-NAME-COMES-HERE"));
function ldrDone(evt:*):void
{
//if the file can be loaded into a Loader object, this part runs
var temp:*;
try
{
temp = evt.target.content;
//add it to the stage
stage.addChild(temp);
//this traces whether the loaded content is a Bitmap (jpg, gif, png) or a MovieClip (swf)
var classOfObject:String = flash.utils.getQualifiedClassName(temp);
trace(classOfObject);
}
catch(error:*)
{
trace("some error was caught, for example swf is AS2, or whatever, like Error #2180");
}
}
function ldrError(evt:*):void
{
//if the file can't be loaded into a Loader object, this part runs
trace("this is the error part, Error #2124 won't show up");
}
这会捕获错误,例如您尝试加载的 swf 是旧的 swf(使用 AS2 发布)- 错误 #2180。
如果找不到文件,或者看起来不是任何可加载格式,则 ioError 部分运行 - 错误 #2124。
关于flash - 如何处理未处理的 IOErrorEvent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5894649/
如何处理\捕获这个错误 Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type. 我尝试使用 AS3 将损坏
Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load NeverCompleted. 这就是我每次尝试使用 Loader 加载不存在
我一直收到错误#1009,因为我试图使用ioErrorHandler函数内部的addChild显示警报框。 trace("IOErrorEvent: " + event);正常工作。但是我在Alert
我正在为 api 编写 actionscript 库。我使用 URLLoader 对象从 api 加载数据。我遇到的问题是,每当 api 在 400 秒中返回 http 状态时,actionscrip
我在 Android 上遇到过这个问题,但我解决了!但在 IOS 中它不起作用,我花了超过 1 天的时间试图解决它。我追踪了文件夹中的所有内容,它给了我正确的路径,但是当我调用声音路径来加载它时,它一
我偶尔会出现Flash pop 错误: 错误#2044:未处理的错误:。文字= 我的代码在这里: private var _myLoader:URLLoader = new URLLoader
我使用代码但出现错误 msg: Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found. var myLoader:
我是一名优秀的程序员,十分优秀!