AS3 -TypeError#1009 - 任何简单的方法来找出其中* *对象的引用为空?方法来、为空、对象、简单

由网友(2019最潮的)分享简介:我们都得到类型错误#1009无法访问空对象引用的属性或方法现在,然后 - 没什么大不了的,但有时令人沮丧的调试。 We all get "TypeError #1009 Cannot access a property or method of a null object reference" now and the...

我们都得到类型错误#1009无法访问空对象引用的属性或方法现在,然后 - 没什么大不了的,但有时令人沮丧的调试。

We all get "TypeError #1009 Cannot access a property or method of a null object reference" now and then - no big deal, but sometimes frustrating to debug.

闪存让你的调用堆栈(这是一个开始),但保留这些给你找出其中的空对象是 - 是否有可能发现的到底是哪个的参考抛错误?

Flash gives you the call stack (which is a start), but leaves it up to you to figure out where the null object is - is it possible to find out exactly which reference is throwing the error?

由于以下(容易出错)功能:

Given the following (error prone) function:

function nullObjectReferenceError():void
	{
		var obj:Object;
		var prop:* = obj.nonExistentProperty;
	}

而不是仅仅从类型错误调用堆栈,我想追查是这样的:的在 obj.nonExistentProperty 的? - 这甚至可能

Rather than just the call stack from the TypeError, I'd like to trace something like: "Cannot access a property or method of a null object reference at obj.nonExistentProperty" - Is this even possible?

推荐答案

如果您选中允许调试下发布设置在Flash IDE,它可以让你在你的code行号导致错误。

If you check Permit Debugging under Publish Settings in the Flash IDE, it gives you the line number in your code causing the error.

阅读全文

相关推荐

最新文章