In a game I’m creating, the only last part I have left is to create a timer.
Or a countdown to be precise.
But I get thrown an error when I go to the next frame when the timer is finished.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at US_fla::MainTimeline/countDownFunction()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
There must be a way that works so that flash will “gotoAndStop(2);” after 3 minutes?
Please help me
//Timer
var countDown:Timer = new Timer(10, 179);
var minutes:Number = 02;
var seconds:Number = 59;
var countExecute:Number = 03;
countDown.start();
countDown.addEventListener(TimerEvent.TIMER, countDownFunction);
function countDownFunction(event:TimerEvent):void {
seconds--;
if (seconds < 00){
seconds = 59
minutes--;
countExecute--;
trace(countExecute);
}
if (countExecute == 1) {
gotoAndStop();
}
var showTime:String = minutes + ":" + seconds;
timer_txt.text = showTime;
}