Hey guys,
I have a movie clip that animates across a set of labels that are based on a 24hour day. The hours are separated into blocks and the basic idea is to mimic a pda style daily calendar based on the current hour. The day starts at 6am and ends at 9pm.
This is the code i have but doesnt seem to be working correctly, im not sure i have it right here but im thinking the “AM, PM” thing is messing it up…
var myCal:Date = new Date();
var myMinutes:Number = myCal.getMinutes()
var myHours:Number = myCal.getHours()
var myTime:String
if (myHours > 12) {
myTime = “PM”;
} else if (myHours == 12) {
myTime = “PM”;
} else {
myTime = “AM”;
}
if (myHours > 23){
myHours = myHours + 1;
}
if ((myHours <= 6) && (myTime == “AM”)){
gotoAndPlay(“six”);
}
else if ((myHours >= 6) && (myTime == “AM”)){
gotoAndPlay(“one”);
}
else if ((myHours >= 9) && (myTime == “AM”)){
gotoAndPlay(“two”);
}
else if ((myHours >= 12) && (myTime == “AM”)){
gotoAndPlay(“three”);
}
else if ((myHours >= 15) && (myTime == “PM”)){
gotoAndPlay(“four”);
}
else if ((myHours >= 18) && (myTime == “PM”)){
gotoAndPlay(“five”);
}
else if ((myHours >= 21) && (myTime == “PM”)){
gotoAndPlay(“six”);
}
Thanks to anyone who can help!