This is the actionscript that makes the clock and the alarm function:
now = new Date();
hours = now.getHours();
minutes = now.getMinutes();
seconds = now.getSeconds();
//this adds a zero to the left of the digit if the seconds are under 10
if (seconds < 10 ) {
timeseconds = "0" + seconds;
} else{
timeseconds = seconds;
};
//this adds a zero if the minutes are under 10
if (minutes < 10 ) {
timeminutes = "0" + minutes;
} else{
timeminutes = minutes;
};
this.bighand._rotation = minutes * 6;
this.secondhand._rotation = seconds * 6;
// script below converts military time to normal
if (hours > 12) {
hours = hours - 12;
};
//a student: ted elyard, suggested this solution below for tracking the hour hand
this.littlehand._rotation = (hours * 30) + (minutes / 2);
//this is the alarm turn on and off code below
this.alarmhand._rotation = (alarmhour * 30) + (alarmminute / 2);
if (this.littlehand._rotation == this.alarmhand._rotation){
if (numberofmovies != 1) {
loadMovie( "wakeup.swf", this.empty );
numberofmovies = 1;
}
} else {
unloadMovie(this.empty);
numberofmovies = 0;
}