Groups | Blog | Home
all groups > flash actionscript > july 2004 >

flash actionscript : time based loop


indyfro
7/7/2004 9:22:04 PM
I realize this question is pretty wide in it's scope, but an answer would
REALLY help. I am trying to create a small scheduling program that uses a
database to populate data in a web page. I would like for the schedule to
prompt the user at certain times, provided certain criteria are met. for
example, if the end time of a certain event has passed, I would like the
program to generate an alert stating that the event is finished. First, using
actionscript, how do i call the current time into the program? secondly, how
can I compare the current time to something like an end time? I figured a
standard if else statement would work, but I am quickly discovering it isn't
that simple...

any help is greatly appreciated....
Fro
kglad
7/7/2004 9:54:27 PM
you can use getTimer() to obtain the time(s) at certain key points in your
movie. you can use setInterval() to initiate a function call after an amount
of time that can be fixed or variable. you can use the Date() object to obtain
the clients date/time. and finally you may be able to access your server's
date/time using a server-side executable like perl or asp etc.
YocheG
7/7/2004 10:00:54 PM
hi...have you taken a look at the new function setInterval? It's great to call
within a certain frequency, e.g. every 10 seconds or if you want every 5 hours.
It works like this:


myTimer = setInterval(myFunction,5000);

function myFunction(){
trace("and again five seconds have past");
clearInterval(myTimer); // remove this line if you want the function to ce
balled continuously..
}

The second parameter of setIntervals is the time in miliseconds after which
the function is called. I don't know if it accepts values that allow you to
call a function every ten weeks, but for some hours it should work.
AddThis Social Bookmark Button