我做了一个捕手游戏,当时间耗尽时遇到麻烦无法移动框架
我已经做过的事情:
function addMc()
{
var NewMc = new MC();
NewMc.y = Math.ceil(Math.random() * 500);
NewMc.x = 50;
addChildAt(NewMc,1);
pelotas.push(NewMc);
NewMc.addEventListener(Event.ENTER_FRAME, dropMc);
}
function dropMc(e:Event)
{
var b:MC = MC(e.target);
b.x += 10;
if (b.x > 900)
{
eliminasiMC(b);
}
}
stage.addEventListener(Event.ENTER_FRAME, catcher);
function catcher(e:Event)
{
catcherMC.y = mouseY;
for (var i:int=0; i<pelotas.length; i++)
{
if (catcher.hitTestObject(pelotas[i]))
{
eliminasiMC(pelotas[i]);
point++;
txtPoint.text = String(point);
}
}
}
function eliminasiMC(B)
{
B.removeEventListener(Event.ENTER_FRAME, dropMc);
removeChild(B);
}
var tTime:Number = 5;
var timer:Timer = new Timer(1000,tTime);
timer.addEventListener(TimerEvent.TIMER, countdown);
timer.start();
function countdown(event:TimerEvent)
{
txtTime.text=String((tTime)-timer.currentCount);
if (txtTime.text == "0")
{
stage.removeEventListener(Event.ENTER_FRAME, catcher);
timer.stop();
timer.removeEventListener(TimerEvent.TIMER, countdown);
gotoAndStop("nextFrame"); // HERE MY PROBLEM
}
}
但是发生了这个错误:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at GEBUGENDE_fla::MainTimeline/addBabi()[GEBUGENDE_fla.MainTimeline::frame80:18] at Function/http://adobe.com/AS3/2006/builtin::apply() at SetIntervalTimer/onTimer() at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick()