Server time
I'm trying to create a clock which shows the time returned by the server. Help me to get this code working with the server time on..
(E.g.: time.php returns 1295532770)
server = new LoadVars();
server.onData = function (src){
clock_txt.onEnterFrame = time;
this.time = Number(src);
};
server.load("http://www.me.com/time.php");
var seconds = this.time/1000
var minutes = this.time/60
var hours = this.time/60
if (hours<12) {
ampm = "AM";
}
else{
ampm = "PM";
}
while(hours >12){
hours = hours - 12;
}
if(hours<10)
{
hours = "0" + hours;
}
if(minutes<10)
{
minutes = "0" + minutes;
}
if(seconds<10)
{
seconds = "0" + seconds;
}
clock_txt.text = hours + ":" + minutes + ":" + seconds +" "+ ampm;
