我收到“TypeError:错误#1009:无法访问空对象引用的属性或方法。”我的 AIR 项目因使用按钮而出现错误。
所以我的问题是,我正在处理我的 Adobe Air 项目,所以我决定编写一些按钮以便能够导航。这里的问题是我尝试这样做时遇到错误。这是我的代码。
import flash.events.MouseEvent;
this.stop();
play_btn.addEventListener(MouseEvent.MOUSE_DOWN, playButtonClick);
function playButtonClick(evt:MouseEvent) {
gotoAndPlay(337);
}
我实际上没有看到什么问题,我在一个空白的非 AIR 文件上尝试了这个,效果很好。感谢您的帮助!
So my problem here is, I'm working on my Adobe Air project, so I decided to code some buttons to be able to navigate. The problem here is that I get a error for trying to do so. Here is my code.
import flash.events.MouseEvent;
this.stop();
play_btn.addEventListener(MouseEvent.MOUSE_DOWN, playButtonClick);
function playButtonClick(evt:MouseEvent) {
gotoAndPlay(337);
}
I do not see what is wrong actually, I tried this on a blank non-AIR file, and it worked well. Thanks for helping!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果没有正确的上下文,很难说,但是 1009 错误意味着您正在尝试访问一个空对象。
从您发布的那个非常小的片段来看,要么 play_btn 为空,要么如 wwwOzOk 所说,帧 337 不会退出(尽管我不确定尝试移动到不存在的帧是否会通过 1009)。
HTH
J
It's very difficult to say without the proper context, but that 1009 error means you are trying to access an object that is null.
From that very small snippet you've posted, either play_btn is null or as wwwOzOk says, frame 337 does not exit (although I'm not sure trying to move to a frame that doesn't exist would through 1009).
HTH
J
试试这个:
如果你得到一个 <<空>>如果跟踪中的值,则这意味着您的按钮未在此帧中实例化。确保在尝试访问按钮之前已创建该按钮;)
Try this:
If you get a << null >> value in trace then this means that your button was not instantiated at this frame. Make sure the button gets created before trying to access it ;)