Page 1 of 1

Flash digital clock.

Posted: Sat Sep 12, 2009 9:45 pm
by Torniquet
Ok i have made a clock followin a tut in flash.

thing is it is reading the time from the local computer rather than the server. http://www.netrixnetwork.com/test/test.html <<can see it there.

Code:

Code: Select all

var now:Date = new Date();

var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();

if (hours >= 12) {
	ampm_txt.text = "PM";
} else {
	ampm_txt.text = "AM";
}

if (hours > 12){	
	hours = hours - 12;
}
if (hours == 00){	
	hours = 12;
}

if (hours < 10){	
	hours_txt.text = "0" + hours;
} else {
	hours_txt.text = hours;
}

if (minutes < 10){	
	minutes_txt.text = "0" + minutes;
} else {
	minutes_txt.text = minutes;
}

if (seconds < 10){	
	seconds_txt.text = "0" + seconds;
} else {
	seconds_txt.text = seconds;
}
Does anyone know enough about flash to make it read from the server and display the server time rather than the local time??

fanx xx

Re: Flash digital clock.

Posted: Sun Sep 13, 2009 2:00 am
by Jackolantern
I assume this is for a game, to display the in-game time? Otherwise, you would want it to be the user's local time and not the server's time zone, which is very likely to be wrong for a large amount of visitors.

Re: Flash digital clock.

Posted: Sun Sep 13, 2009 6:09 am
by Torniquet
Jackolantern wrote:I assume this is for a game, to display the in-game time? Otherwise, you would want it to be the user's local time and not the server's time zone, which is very likely to be wrong for a large amount of visitors.
thats the idea :)tis either tht or i leave it static and read from php lol.

Re: Flash digital clock.

Posted: Mon Sep 14, 2009 1:27 am
by Jackolantern
Well, it would make sense to me that ActionScript would have some way to read the server time as opposed to just the user's local time. I don't know AS, but I am assuming you could read it out of PHP if you could not do it with AS.