actionscript-3 - 是否存在ActionScript 3错误1046处理程序?

标签 actionscript-3 flash error-handling

我说的是这个错误:

ERROR 1046: Type was not found or was not a compile-time constant: CustomType
.as文件的类中定义CustomType的位置。我知道您需要导入该文件以避免此错误,但是我的问题是,此错误是否有任何错误处理程序?
我的意思是,有没有办法说,例如:
onErrorHandler {
  trace("You need to import the class!");
} else {
  private var myObject:CustomType;
}

最佳答案

该错误是在编译时抛出的,所以没有。
import语句告诉Flash当前类要正常运行需要编译哪些类。您无法编写代码来捕获在编译时引发的错误,因为它不会编译,因此无法执行。

捕捉这些错误,不是您的错误,是编译器的责任。

关于actionscript-3 - 是否存在ActionScript 3错误1046处理程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16725248/

相关文章:

javascript - ActionscriptExternalInterface调用未到达javascript

flash - AS3 :How to change a colored Bitmap's BitmapData to black and white?

r - 如何从2个数据集中找到回归模型分析?

function - 在 Haskell 中减少命题的大小

xml - 使用 htmlText 嵌入 AS3 字体

php - 模糊或隐藏 PHP-AS3 项目中使用的路径的最简单方法是什么

actionscript-3 - 动态 xml 文本和图像不会在 Flash 中刷新

actionscript-3 - AS3 : "Variable [x] is not defined" error when using getDefinitionByName()

flash - Flash GUI 框架 (as3)

bash - 如果命令失败,为什么 `if` 语句的退出代码不是失败?