Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : Time of Day


Doctor Wink
5/3/2004 9:54:48 PM
I'm trying to make a html desktop backround with flash on it. And I want it to
change with the time of day, for example: 5 am - 8 am would be a sunset, and
then 9 am - 11 am, a early day thing, then 12 pm - 3 pm a noonish type thing, 4
pm - 7 pm, a early evening thing, then 8 pm - 9:30 pm a sunset, 9:30 pm - 12 am
some night type thing, then 1 am - 5 am some other night thing. It'd be like
the aol backrounds (if you have aol 9.0). but I'm just wondering what the
actionascripts would be and such, cuz im just more of a designer, not coder =(
thank you much =D
mandingo
5/3/2004 11:35:29 PM
Hi,

This is one way of handling the various times for the load behaviour...

thisDate = new Date();
thisDate.currentTime = thisDate.getHours() + ":" + thisDate.getMinutes();
trace(thisDate.currentTime);

if(thisDate.getHours()>=1 && thisDate.getHours() <=4){timeOfDay = 0;}
if(thisDate.getHours()>=5 && thisDate.getHours() <=8){timeOfDay = 1;}
if(thisDate.getHours()>=9 && thisDate.getHours() <=11){timeOfDay = 2;}
if(thisDate.getHours()>=12 && thisDate.getHours() <=15){timeOfDay = 3;}
if(thisDate.getHours()>=16 && thisDate.getHours() <=19){timeOfDay = 4;}
if(thisDate.getHours()>=19 && thisDate.getHours() <=21){timeOfDay = 5;}
if(thisDate.getHours()>=21 && thisDate.getHours() <=23){timeOfDay = 6;}
switch(timeOfDay){
case 0:
// load the appropriate scene
trace("the very early morning scene loads here");
break;
case 1:
// load the appropriate scene
trace("the sunrise scene loads here");
break;
case 2:
// load the appropriate scene
trace("the morning scene loads here");
break;
case 3:
// load the appropriate scene
trace("the midday scene loads here");
break;
case 4:
// load the appropriate scene
trace("the dusk scene loads here");
break;
case 5:
// load the appropriate scene
trace("the sunset scene loads here");
break;
case 6:
// load the appropriate scene
trace("the late night scene loads here");
break;
}


hope that helps,
cheers,
peterblaze
5/4/2004 12:33:57 AM
Hi,
simply tutorial but I hope it helps You:
http://www.flashkit.com/tutorials/Tips_And_Techniques/Controll-k-gianni-788/index.php
hth,
peter
[quoted text, click to view]

Doctor Wink
5/5/2004 2:37:46 AM
AddThis Social Bookmark Button