Hi there. I have been tasked with creating a countdown for a splash page. I am not too familiar with flash so I took a couple online lessons and found some great sources to help me come up with a countdown which you can see here. http://www.swfcabin.com/open/1376959235


Now, my colleauge asked if it is possible to have the numbers turn red on each circle, which i was able to accomplish here: http://www.swfcabin.com/open/1376958743


If you notice, the countdown no longer works on on the second example and I keep getting an error message and I honestly have no idea what's going on. I tried playing with the timeline with no success and my capacity with ActionScript 3 is beginner at best. I was actually able to find an online tutorial that gave me some code to use and i just played around with it for my use.


Here is the error message i get:


TypeError: Error #1009: Cannot access a property or method of a null object reference.

at BirthdayCountdown_fla::MainTimeline/loop()




Here is the code I am using:


var targetDateate = new Date(2014, 7, 8, 15);

addEventListener(Event.ENTER_FRAME, loop);

function loop(e:Event):void
{
var nowDateate = new Date();
var ms:Number = targetDate.getTime() - nowDate.getTime();
var sec:Number = Math.floor(ms/1000);
var min:Number = Math.floor(sec/60);
var hr:Number = Math.floor(min/60);
var day:Number = Math.floor(hr/24);

sec = sec % 60;
min = min % 60;
hr = hr % 24;

daytxt.text = day.toString();
hrtxt.text = (hr < 10) ? "0"+hr.toString() : hr.toString();
mintxt.text = (min < 10) ? "0"+min.toString() : min.toString();
sectxt.text = (sec < 10) ? "0"+sec.toString() : sec.toString();
}



and here is a screenshot of my timeline.

http://imgur.com/A6xMFx3