flash - 一旦变成.swf,您如何在Flash中以某种方式显示错误?

标签 flash error-handling

我的错误是

Error opening URL "http://www.website.com/something.php?query=someinvalidquery"

该查询实际上不应该执行,但是我想要某种错误消息这样说。

最佳答案

假设您使用的是URLLoader或其他内容,您想为其附加一个事件以捕获错误。然后,您可以显示文本字段或任何您想要的内容。

var url = "http://www.website.com/something.php?query=someinvalidquery";
var loader = new URLLoader();
loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
loader.load(url);

function errorHandler(event:IOErrorEvent):void {
    trace('do whatever to handle the error here.');
}

如果您想处理重定向等操作,也可以跟踪httpstatus等。使用的事件是in the docs

关于flash - 一旦变成.swf,您如何在Flash中以某种方式显示错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3763552/

相关文章:

flash - SWF 对象 - 我为什么要使用它

Javascript函数调用-ActionScript

java - Spring Boot 调度程序线程随机停止

php - 忽略PHP错误,同时仍打印自定义错误消息

actionscript-3 - 使用来自 Flash/AS3 的 Google Analytics Measurement Protocol/Universal Analytics

闪光灯, ActionScript 3 : get all movieclips that are containing in a movieclip

vb.net - 如何处理 VB.NET 程序中因无效用户输入而导致的错误?

javascript - 如何防止空白页对HTTP错误使用react

c - 警告 'return' 无值,函数返回非 void - 它应该返回什么?

iphone - 来自 Web url 的 IOS 应用程序上的 SWF