Actionscript 3 无法移动框架
我做了一个捕手游戏,遇到了麻烦,当时间用完时无法移动画面 我已经做了:Actionscript 3 无法移动框架,actionscript-3,flash,timer,Actionscript 3,Flash,Timer,我做了一个捕手游戏,遇到了麻烦,当时间用完时无法移动画面 我已经做了: 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 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
}
}
在
addBabi()
函数的第80帧的第18行中有一个null
对象。尝试验证该帧或放入该帧的代码。PosteliminasiMC()
函数。此外,您永远不会清除pelotas上已消除的对象,这最终会使您的游戏陷入困境。请将第80帧的代码添加到问题中,为此,请按问题下方的“编辑”并添加更多文本。
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()