Help! How to create a count up in Animate?
I'm creating an animated info graphic about tigers and need a count up from 0 to 3200 to show the current population of tigers in Asia.
This is my current Code:
import flash.display.*;
import flash.events.*;
import flash.utils.*;
var countUpInc:int = 20;
var totalSecs:int = 1000;
var count = 0;
var countTimer:Timer = new Timer(countUpInc);
countTimer.addEventListener(TimerEvent.TIMER, timerHandler);
countTimer.start();
function timerHandler(e:TimerEvent): void {
if (count !== 3200) {
count = count + countUpInc;
counter.text = count;
trace(count);
}
}
the code runs in console but when line 19 is uncommented it crashes at 1280.
I get the error:
" TypeError: Error #1009: Cannot access a property or method of a null object reference.
at TigerInfographic_fla::MainTimeline/timerHandler()[TigerInfographic_fla.MainTimeline::fram e210:17]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick() "
i don't know how to fix it.
.fla file: NBeaulieu_FinalAnimation.zip - Google Drive