在AS3中修复错误1009的最佳解决方案是什么?

时间:2017-07-08 15:24:27

标签: actionscript-3 flash

我使用Adobe Animate CC 2015创建了关于安卓游戏的论文。当我进入主游戏时,我的角色走了,问卷出现了,然后是“正确!”窗口出现,所以它都存在于第75帧。所以在“正确!”窗口有“Go”按钮,当我点击它时我收到错误1009.它应该是当我点击“Go”按钮时,它应该在第76帧继续。所以这是消息:

TypeError: Error #1009: Cannot access a property or method of a null object reference. at RECOVER_RECOVER_RECOVER_RECOVER_diemgeym_fla::MainTimeline/frame76()[RECOVER_RECOVER_RECOVER_RECOVER_diemgeym_fla.MainTimeline::frame76:21] at flash.display::Sprite/constructChildren() at flash.display::Sprite() at flash.display::MovieClip() at QuizQuest2() at flash.display::MovieClip/gotoAndStop() at RECOVER_RECOVER_RECOVER_RECOVER_diemgeym_fla::MainTimeline/gura()[RECOVER_RECOVER_RECOVER_RECOVER_diemgeym_fla.MainTimeline::frame75:108]

这是我的代码(实际上我把这些代码分开但是所有这些代码都存在于第76帧中,但我将它们完全结合在一起):

stop();
import flash.events.Event;
import flash.text.*;
import flash.display.MovieClip;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.MouseEvent;
import flash.display.DisplayObject;
import flash.geom.Point;
import flash.display.Stage;
//import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;

var goiX = playergril2.x;
var goiY = playergril2.y;
pausewin2.visible = false;
corekWin2.visible = false;
maliWin2.visible = false;
btnGub.visible = false;
quizQuest2.visible = false;

btnForward2.addEventListener(MouseEvent.CLICK, setpositionz);

function setpositionz(event: MouseEvent) {
goiX = mouseX;
goiY = mouseY;
playergril2.x += 15;
playergril2.play();
stage.addEventListener(Event.ENTER_FRAME, loopz);
}

function loopz(event: Event) {
if (keyCollected == false) {
    if (playergril2.hitTestObject(key2)) {
        key2.visible = false;
        keyCollected = true;
        btnGub.visible = true;
        trace("key collected");
        //removeEventListener(Event.ENTER_FRAME, loop);
    }
}
}
 btnGub.addEventListener(MouseEvent.CLICK, forwardz);
  function forwardz(event: MouseEvent): void {
    quizQuest2.visible = true;
    playergril2.visible = false;
}

-------
txtSkor2.text = String(iskoru2);
txtLives2.text = String(buhay2);
txtHints2.text = String(hinto2);
quizQuest2.nohint2.visible = false;
var sec2: Number = 15;
quizQuest2.secBox2.text = String(sec2);
var gameTimer2: Timer = new Timer(1000);

gameTimer2.addEventListener(TimerEvent.TIMER, countDown2);
gameTimer2.start();


function countDown2(event: TimerEvent): void {
sec2--;
if (sec2 < 0) {
    gameTimer2.stop();
    gameTimer2.removeEventListener(TimerEvent.TIMER, countDown2);
    maliWin2.visible = true;
    quizQuest2.visible = false;
}
}

 quizQuest2.ans21.addEventListener(MouseEvent.CLICK, buttones2);
 quizQuest2.ans22.addEventListener(MouseEvent.CLICK, buttones2);
 quizQuest2.ans23.addEventListener(MouseEvent.CLICK, buttones2);

function buttones2(event:Event):void{
  if(event.currentTarget == quizQuest2.ans23){
    quizQuest2.visible = false;
    corekWin2.visible = true;
    iskoru2 += 10;
}else if(event.currentTarget == quizQuest2.ans21 || event.currentTarget == quizQuest2.ans22){
    quizQuest2.visible = false;
    maliWin2.visible = true;
    buhay2 -= 1;
}
}

quizQuest2.btnHint2.addEventListener(MouseEvent.CLICK, woo);
function woo(event: MouseEvent): void {
hinto2 -= 1;
quizQuest2.txtHint2.visible = true;
if (hinto2 == 0) {
    quizQuest2.nohint2.visible = true;
}
}
corekWin2.btnGo2.addEventListener(MouseEvent.CLICK, gura2);

function gura2(event: MouseEvent): void {
corekWin2.visible = false;
quizQuest2.visible = false;
gotoAndStop(77);
}

-------
maliWin2.btnGobak2.addEventListener(MouseEvent.CLICK, bey2);

function bey2(event: MouseEvent): void {
maliWin2.visible = false;
}

------
btnPause2.addEventListener(MouseEvent.CLICK, oop2);

function oop2(event: MouseEvent): void {
stage.frameRate = 0;
pausewin2.visible = true;

pausewin2.btnResume2.addEventListener(MouseEvent.CLICK, op2);
pausewin2.btnQtm2.addEventListener(MouseEvent.CLICK, oip2);
}
function op2(event: MouseEvent): void {
stage.frameRate = 24;
pausewin2.visible = false;
}
function oip2(event: MouseEvent): void {
gotoAndStop(1);
}

问题代码是:quizQuest2.visible = false;所以我确实允许调试。 我仔细检查了我的所有代码,对象(动画片段,文本字段和按钮),以及帧76中的实例名称,所有这些都匹配,即使quizQuest2已经存在于第76帧中,但仍然,我得到错误1009和我无法弄清楚为什么会发生。我真的不知道我该如何解决它。

因此,我将在此提供一些GUI的屏幕截图,如下所示: 1. The quizQuest2 movieclip with some other movieclips exist in frame 76 2. The pausewin2 with two buttons inside of it

我确实提供了这些截图供你查看76帧上的内容,但它应该是5个截图,但其他3个截图不能,因为它说我需要10个代表才能上传更多内容。无论如何,我应该怎么做或解决我如何解决这个问题的最佳解决方案?我需要你的帮助,因为我的论文答辩几近。谢谢。

0 个答案:

没有答案