AS3 -TypeError#1009 - 任何简单的方法来找出其中* *对象的引用为空? [英] AS3 -TypeError #1009 - any easy way to find out *which* object reference is null?

查看:119
本文介绍了AS3 -TypeError#1009 - 任何简单的方法来找出其中* *对象的引用为空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都得到类型错误#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.

这篇关于AS3 -TypeError#1009 - 任何简单的方法来找出其中* *对象的引用为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆