Setting Time in flash?

is there any ways for me to load time from Observatory , if it cant not be connected, then load server time .

i’ve tried something like this but the output is undefined …


mydate = new Date();
hkotime = new LoadVars();
hkotime.sendAndLoad(basehref+"server_time_hko.php", hkotime, "POST");
hkotime.onLoad = function(success) {
 if (success) {
  if (hkotime.hkosecond_s != null && hkotime.hkominute_s != null && hkotime.hkohour_s != null) {
   seconds = hkotime.hkosecond_s;
   minutes = hkotime.hkominute_s;
   hours = hkotime.hkohour_s;
   time = "HKO:"+(hours)+":"+(minutes)+":"+(seconds);
  }
 } else {
  servertime.sendAndLoad(basehref+"server_time_server.php.php", servertime, "POST");
  servertime.onLoad = function(success) {
   if (success) {
    if (servertime.serhour_s!= null && servertime.serminute_s != null && servertime.sersecond_s != null) {
     seconds = servertime.sersecond_s;
     minutes = servertime.serminute_s;
     hours = servertime.serhour_s;
     time = "Server:"+(hours)+":"+(minutes)+":"+(seconds);
    }