Im building a flash movie that will have a image of a building that changes according to the time of day. I’m close to getting it figured out, I just cant exactly figure out which variables to use to tell it when to go to the specific frame the new time of day image is.
onClipEvent (enterFrame) {
myTime = new Date();
nSeconds = myTime.getSeconds();
nMinutes = myTime.getMinutes();
nHours = myTime.getHours();
if (nHours>=12) {
ampm = "pm";
} else {
ampm = "am";
}
if (nHours>=13) {
nHours = nHours-12;
}
if (length(nMinutes) == 1) {
nMinutes = "0"+nMinutes;
}
if (length(nSeconds) == 1) {
nSeconds = "0"+nSeconds;
}
nTime = nHours+":"+nMinutes+":"+nSeconds+" "+ampm;
}
I’ve managed to get it to switch if I set it to just a number by just adding:
if (nHours>=1) {
_root.day.gotoandPlay("day")
} else {
_root.day.gotoandPlay("night")
How exactly can I tell it to go according to 7am-8pm and 8pm-7am? Once I figure this part out I’ll be able to start adding in more images and detailed times of day, and possibly integrate weather etc in the future.
Thanks for any help.