Flash digital clock.

C++, C#, Java, PHP, ect...
Post Reply
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Flash digital clock.

Post 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
New Site Coming Soon! Stay tuned :D
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Flash digital clock.

Post 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.
The indelible lord of tl;dr
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: Flash digital clock.

Post 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.
New Site Coming Soon! Stay tuned :D
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Flash digital clock.

Post 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.
The indelible lord of tl;dr
Post Reply

Return to “Coding”