【问题标题】:Can you get the IOError that caused the IOErrorEvent?你能得到导致 IOErrorEvent 的 IOError 吗?
【发布时间】:2014-06-05 11:46:24
【问题描述】:

在 Flash/AS3 应用程序中,当 I/O 操作失败时,您可以获得IOErrorEvent

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loaded);
loader.addEventListener(IOErrorEvent.IO_ERROR, problem);
loader.load(new URLRequest("config.xml"));

function problem(e:IOErrorEvent)
{
    trace(e.toString());
}

我想知道失败的原因。有没有办法从事件中获取IOErrortoString() 方法并没有为我们提供很多信息,其他任何方法也没有。

【问题讨论】:

    标签: actionscript-3 flash events ioerror


    【解决方案1】:

    IOErrorEvent 错误:http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/IOErrorEvent.html

    它有你需要的所有东西:

    • errorID - 参考号
    • target/currentTarget - 调度它的那个
    • 文字
    • type - 错误的类型(查看here 获取 IO 常量列表)

    我想不出你可能想知道的其他事情:)

    【讨论】:

    • 好的。现在,我想知道为什么它没有关于您尝试加载的文件的任何信息(在投影仪上时)。
    • 您使用的是loader.load(new URLRequest("config.xml"));.. 您希望错误中包含有关您不知道的网址的信息吗? :) IO_ERROR 不仅在加载文件时使用,它用于很多事情,因此它不包含有关您的文件的信息(您应该知道)
    猜你喜欢
    • 2011-11-03
    • 1970-01-01
    • 2012-01-31
    • 2014-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-30
    • 1970-01-01
    相关资源
    最近更新 更多