Groups | Blog | Home
all groups > flash data integration > june 2006 >

flash data integration : Get RealCurrenttime


amilton22
6/12/2006 6:16:18 PM
Does anyone know an url where I can get the current time as either a string or
a number? Or how do I solve the problem that flash can't retrieve an external
time? Or does anybody have a perl-file that they wouldn't mind sharing with me
that could do the trick

Thanks!
Motion Maker
6/12/2006 10:33:03 PM
There is client side time and serverside time. There is local time and
Greenwich mean time, now called universal time or UTC.

In Flash you can use the Date Actionscript class for the client time:
http://livedocs.macromedia.com/flash/8/main/00002128.html. The local time
will depend on each user's machine's time setting.

For the server side you need to know what scripting languages you have and
use one to form the time as a response output. Then Flash can fetch that
from the serverside script. Serverside time also has a local and UTC. The
local time will be the time set in the web server, usually the time zone in
which it is located. However through scripting you can adjust that to any
timezone but accessint GMT.

It really depends on what you want from the server, just an written
description of the time or specific time elements such as month, day, year,
minute, second, millisecond.

This provides a something like this Wednesday 15th of January 2003 05:51:38
AM
in PHP
echo date("l dS of F Y h:i:s A");

On the Flash side you could use LoadVars to fetch a PHP script that would
look like this
<%
echo "serverdate=".date("l dS of F Y h:i:s A");
%>

var my_lv:LoadVars = new LoadVars();
my_lv.onLoad = function(success:Boolean) {
if (success) {
trace(this.serverdate); my_txt.text = this.serverdate;
} else {
trace("Error loading/parsing LoadVars.");
}
};
my_lv.load(http://www.helpexamples.com/phptimescript.php);

--
Lon Hosford
www.lonhosford.com
Flash, Actionscript and Flash Media Server examples:
http://flashexamples.hosfordusa.com
May many happy bits flow your way!
[quoted text, click to view]

amilton22
6/13/2006 5:55:29 PM
AddThis Social Bookmark Button