Originally posted by: rh71
Originally posted by: CasioTech
Originally posted by: rh71
why isn't the clock dynamically reading ? Just on page-load... defeats the purpose.
I can't get the script right
In a new/separate movieClip, create 2 keyframes ... 1st one contains the attached code below. 2nd keyframe should gotoandPlay(1) so that it refreshes the clock every second (or faster depending on your fps). Once you have this new movieClip created, place this movieClip onto the main timeline and name it "datevar".
Here's the AS code I used mentioned for keyframe 1... of course you're going to tweak it to use just the time without the date in yours:
myDate = new Date();
// Format Month
if (myDate.getMonth() == "0") {
theMonth = "January";
} else if (myDate.getMonth() == "1") {
theMonth = "February";
} else if (myDate.getMonth() == "2") {
theMonth = "March";
} else if (myDate.getMonth() == "3") {
theMonth = "April";
} else if (myDate.getMonth() == "4") {
theMonth = "May";
} else if (myDate.getMonth() == "5") {
theMonth = "June";
} else if (myDate.getMonth() == "6") {
theMonth = "July";
} else if (myDate.getMonth() == "7") {
theMonth = "August";
} else if (myDate.getMonth() == "8") {
theMonth = "September";
} else if (myDate.getMonth() == "9") {
theMonth = "October";
} else if (myDate.getMonth() == "10") {
theMonth = "November";
} else if (myDate.getMonth() == "11") {
theMonth = "December";
}
// Format minutes
if (myDate.getMinutes()<"10") {
newMinutes = "0"+myDate.getMinutes();
} else {
newMinutes = myDate.getMinutes();
}
// Format seconds
if (myDate.getSeconds()<"10") {
newSeconds = "0"+myDate.getSeconds();
} else {
newSeconds = myDate.getSeconds();
}
dateVar = (theMonth+" "+myDate.getDate()+" {"+myDate.getHours()+":"+newMinutes+":"+newSeconds+"}");