Code Works-->Digital Clock

I’ve successfully written code for a digital clock. Translation…, I have no errors to debug. I have three layers: “actions” for code, “text” for text, and “background” for a green background. With the exception of my “actions” layer, my layers extend up to frame 2 with no special effects… such as tweens, blurs, etc.

Still, I’m posting to this forum because I need the time to display without having to extend my layers to frame 2. This is part of a bigger project that needs the time to display with the use of only one frame for my layers.

I’ve posed the flash file and written the code below. Any help would be appreciated.

var currentDate:Date= new Date(); :smiley: //Smily face is part of code, that’s why it works!
var hoursDigit:Number = currentDate.getHours();
var minutesDigit:Number = currentDate.getMinutes();
var secondsDigit:Number = currentDate.getSeconds();
var hoursZero:String=“”;
var minutesZero:String=“”;
var secondsZero:String=“”;
var ampmName:String;
var myTime:String;
if(hoursDigit<12) {
ampmName= “AM”;
} else {
hoursDigit= hoursDigit - 12;
ampmName= “PM”;
}
if(hoursDigit<10)
hoursZero= " ";
if(minutesDigit<10)
minutesZero= “0”;
if(secondsDigit<10)
secondsZero= “0”;
myTime=hoursZero+hoursDigit + “:” +
minutesZero+minutesDigit + “:” +
secondsZero+secondsDigit + " " + ampmName;

clock_txt.text=myTime;