I’ve made all kinds of clocks (like on my site in the top right corner). I always just use dynamic text boxes with the font of my choosing and do something like this: -I’ll comment it; I didn’t realize it was so long!
onClipEvent (load) {
//this sets up the arrays of the months and days
months = ["January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
days = ["SUN", "MON", "TUE", "WED", "THR", "FRI", "SAT"];
pm=0;
}
onClipEvent (enterFrame) {
//get's system date and time every frame
//and gets various parts of time
now = new Date();
h = now.getHours();
m = now.getMinutes();
s = now.getSeconds();
//convert from military time
if (h>12) {
h -= 12;
pm = 1;
}
if (h == 0) {
h = 12;
}
//changes like 9 minutes to 09 minutes
if (m<10) {
m = "0"+m;
}
//do the same with seconds
if (s<10) {
s = "0"+s;
}
//set up time for text box called 'time'
_root.time = h+":"+m+":"+s;
//For spacing, I put in an extra text box called 'thing' to display
//either AM or PM. The variable is set later (ap)
_root.thing = ap;
//gets date information
month = months[now.getMonth()];
//this pulls the name out of the array 'months'
year = now.getFullYear();
day = days[now.getDay()];
//this pulls the name out of the array 'days'
dnum = now.getDate();
//this gets the numerical day's date
st = "th";
//defaults 'st' to 'th' for like 14th or 17th
//then the next stuff is changing the defalt for 'st',
//'nd' and 'rd'
if (dnum == "1" or dnum == "21" or dnum == "31") {
st = "st";
}
if (dnum == "2" or dnum == "22") {
st = "nd";
}
if (dnum == "3" or dnum == "23") {
st = "rd";
}
_root.date = month+" "+dnum+st;
//sends formatted date to a text box called 'date'
_root.dyear = year;
//sends year to a text box called 'year'
_root.dday = day;
//sends formatted day (word) to a text box called 'dday'
//this last bit tacks on either 'am' or 'pm' to the time
if (pm == 1) {
ap = "PM";
} else {
ap = "AM";
}
}
Hope that helps - I thought it would be a shorter answer - sorry…