2011-01-11 164 views
0

在单击按钮转到另一个框架后,Flash发生此错误。在我收到错误信息后,有些按钮不会到达目的地,而只是不做任何事情。AS3 --- TypeError:错误#1009:无法访问空对象引用的属性或方法

的错误如下:

TypeError: Error #1009: Cannot access a property or method of a null object reference. 
    at wmhssports_fla::MainTimeline/frame39() 

这里是39帧代码:

stop(); 

winter_btn.addEventListener(MouseEvent.CLICK, buttonClick1); 
function buttonClick1(event:MouseEvent):void{ 
gotoAndPlay(39); 
}; 

spring_btn_boys.addEventListener(MouseEvent.CLICK, buttonClick10); 
function buttonClick10(event:MouseEvent):void{ 
gotoAndPlay(114); 
}; 

fall_btn_boys.addEventListener(MouseEvent.CLICK, buttonClick11); 
function buttonClick11(event:MouseEvent):void{ 
gotoAndPlay(135); 
}; 
+1

框架39中定义了`winter_btn`,`spring_btn`和`fall_btn`吗?尝试'trace(fall_btn);`看看你得到了什么。 – 2011-01-11 18:02:40

+0

我会看看这个文件。将其上传到mediafire.com等服务,然后通过我网站上的联系表单发送链接(查看我的个人资料)。 – 2011-01-11 18:52:47

回答

3

我看了一下您的Flash影片/应用程序,以下是解决问题的方法:

.alt text

上面的影像是您的Flash影片/应用程序的时间线的截屏。在第39帧处,您收到错误“TypeError:Error#1009:无法访问空对象引用的属性或方法,位于wmhssports_fla :: MainTimeline/frame39()”。你收到这个,因为那时你的spring_btn按钮的实例spring_btn_girls为空。为了解决这个问题,你的spring_btn按钮实例在框架34上的实例名称为“spring_btn_girls”。

0

一个你链接到不存在(例如错字的按钮名称?)或不在您正在编码的框架上。

正如约翰说的,尝试trace(winter_btn, spring_btn, fall_btn);。返回null的那个是你想纠正的那个。

相关问题