ActionScript 3.0中类型错误 [英] actionscript 3.0 TypeError
问题描述
即时得到这恼人的错误,我不能老是找出问题可能是...
Im getting this annoying error and I can`t figure out what the problem might be...
类型错误:错误#1009:无法访问空对象引用的属性或方法。
在simplifyVirSys_fla :: copyRightAthenaAcademy_1 / initiateApp()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at simplifyVirSys_fla::copyRightAthenaAcademy_1/initiateApp()
我的主要时间线有两个框架: 帧1-的介绍和式2,应用程序本身
My main time line has two frames: frame1-the intro and frame2-the application itself
前奏是一个影片剪辑。开场MC的最后一帧上的code是这样的:
The intro is a movieclip. The code on the last frame of the intro mc goes like this:
addEventListener(Event.ENTER_FRAME, initiateApp);
function initiateApp(e:Event){
MovieClip(root).gotoAndStop(2);
}
所以打的介绍后,就应该跳转到主时间线的第2帧。而that`s在输出窗口去疯狂与#1009错误。
So after playing the intro, it should jump to frame 2 of the main time line. And that`s where the output window goes crazy with the #1009 error.
推荐答案
试试这个:
addEventListener(Event.ADDED_TO_STAGE, this.ready);
function ready(e:Event) {
removeEventListener(Event.ADDED_TO_STAGE, ready);
addEventListener(Event.ENTER_FRAME, initiateApp);
}
function initiateApp(e:Event){
MovieClip(root).gotoAndStop(2);
}
这篇关于ActionScript 3.0中类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!