Groups | Blog | Home
all groups > flash actionscript > october 2005 >

flash actionscript : detect client-side's time to trigger "Day Mode" or "Night Mode"?


phinski
10/12/2005 9:10:25 PM
Hi,

I wonder if it's possible(I haven't see such function though...) to have Flash
to detect client-side's system time and determine it's daytime or nighttime. If
the time range belongs to "daytime" then it will trigger something....

Does anyone see such function before?
2m
10/12/2005 9:26:34 PM
That seems too easy, so maybe I'm missunderstanding you but for now my approch
woud just be to get the time with

now = new Date();
// now[/] is now the time/date of the machine your swf in running/playing on
hour = now.getHours();
// that'll return a number from 0 to 23 - should be enough to determin day or
nightime.

You could try to determin the users location via some ip-locating service and
then compare to current sunrise and sunset times, but that'll be in versin 2 i
guess :-)
phinski
10/12/2005 9:39:19 PM
Is it really so easy... um..
cuz I'd like setup 2 different scene for user who enter the site.
If their time is within 7pm to 4am, they will see night mode...

do you think it's really that simple?

Thanks
2m
10/12/2005 9:44:16 PM
I'm in nightmode right now, but I'm positve it is that simple.

just make 7pm 19 and you'll do great.

phinski
10/12/2005 9:48:10 PM
thanks...
AddThis Social Bookmark Button