20050120
20050118
how to build a digital clock
// START OF .AS CODE (FOR FRAME 1)
time=new Date(); // time object
var seconds = time.getSeconds()
var minutes = time.getMinutes()
var hours = time.getHours()
if (hours<12) {
ampm = "AM";
}
else{
ampm = "PM";
}
while(hours >12){
hours = hours - 12;
}
if(hours<10)
{
hours = "0" + hours;
}
if(minutes<10)
{
minutes = "0" + minutes;
}
if(seconds<10)
{
seconds = "0" + seconds;
}
digclock_txt.text = hours + ":" + minutes + ":" + seconds +" "+ ampm;
// END OF .AS CODE
// START OF .AS CODE (FOR FRAME 2)
gotoAndPlay(1);
// END OF .AS CODE
Congratulations and whoopie!!!
Your digital clock should now be working.
