【问题标题】:Confused about ErrorMessages while debugging Flash调试 Flash 时对 ErrorMessages 感到困惑
【发布时间】:2013-05-11 16:21:14
【问题描述】:

TypeError:错误 #1009:无法访问空对象引用的属性或方法。 在 savethetiger_fla::MainTimeline/frame168()

stop(); 
home_btn.addEventListener(MouseEvent.CLICK,home); 

function home(event:MouseEvent){ 
    gotoAndPlay(1,"scene1"); 
}

aboutus_btn.addEventListener(MouseEvent.CLICK,aboutus);

function aboutus(event:MouseEvent){ 
    gotoAndPlay(1,"Scene2"); 
}

gallery_btn.addEventListener(MouseEvent.CLICK,gallery); 
function gallery(event:MouseEvent){ 
    gotoAndPlay(1,"Scene5"); 
}

contactus_btn.addEventListener(MouseEvent.CLICK,contactus);

function contactus(event:MouseEvent){ 
    gotoAndPlay(1,"Scene4"); 
} 

【问题讨论】:

  • 168 帧上有帧脚本吗?如果有,请发布。
  • 'code'stop(); home_btn.addEventListener(MouseEvent.CLICK,home);功能主页(事件:MouseEvent){ gotoAndPlay(1,"scene1"); } aboutus_btn.addEventListener(MouseEvent.CLICK,aboutus);函数 aboutus(event:MouseEvent){ gotoAndPlay(1,"Scene2"); } gallery_btn.addEventListener(MouseEvent.CLICK,gallery);功能画廊(事件:MouseEvent){ gotoAndPlay(1,"Scene5"); } contactus_btn.addEventListener(MouseEvent.CLICK,contactus);函数contactus(event:MouseEvent){ gotoAndPlay(1,"Scene4"); }
  • 欢迎来到 stack-overflow,您应该编辑您的问题以将代码粘贴到那里。阅读以调试模式运行您的项目,以便您可以看到有问题的行是什么,一般来说,您使用的是 .取消引用当前为空的变量。
  • 确保所有实例名称拼写正确并存在于时间线上:home_btn、contactus_btn、gallery_btn、aboutus_btn
  • TypeError:错误 #1009:无法访问空对象引用的属性或方法。在 savethetiger_fla::MainTimeline/frame168()[savethetiger_fla.MainTimeline::frame168:3]

标签: actionscript-3 flash flash-cs5


【解决方案1】:

您的代码看起来不错,但我们无法确定您是否正确拼写了所有内容,以及分配这些操作时您的按钮是否出现在屏幕上。

一个看起来很奇怪的地方是这个函数的拼写

function home(event:MouseEvent){ 
    gotoAndPlay(1,"scene1"); 
}

您确定是scene1 而不是Scene1? 而且没有Scene3,对吗?

【讨论】:

  • 没有场景 3 我已将其删除...现在我收到另一个错误提示
  • ArgumentError:错误 #2108:找不到场景 Scene2。在 flash.display::MovieClip/gotoAndPlay() 在 savethetiger_fla::MainTimeline/aboutus()[savethetiger_fla.MainTimeline::frame168:13]
  • Scene2 还存在吗?也许你的名字不同。
  • 我从来没有改过名字,但是当我按下所有菜单链接时我就明白了
  • ArgumentError:错误 #2108:找不到场景 Scene5。在 flash.display::MovieClip/gotoAndPlay() at savethetiger_fla::MainTimeline/gallery()[savethetiger_fla.MainTimeline::frame168:20] ArgumentError:错误 #2108:找不到场景 Scene4。在 flash.display::MovieClip/gotoAndPlay() 在 savethetiger_fla::MainTimeline/contactus()[savethetiger_fla.MainTimeline::frame168:27]
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-13
  • 2012-07-22
  • 2013-05-13
  • 2020-04-16
  • 2023-03-08
相关资源
最近更新 更多