Groups | Blog | Home
all groups > flash (macromedia) > october 2005 >

flash (macromedia) : Time accuracy in the Flash


kamyarabhari
10/23/2005 11:46:27 PM
Hi everybody:
I would greatly appreciate any help or comment in advance.
Actually in the application I've made with flash 2004, the time is precisely
important, there are some functions work in the mili-second and must be very
accurate, anyway, the only important fact was the frame rate which I've set to
20fps.
Do you guys have any idea to enhance the application and obstruct the possible
problems.....

tnx
Jeckyl
10/24/2005 12:00:00 AM
Use getTimer

It is the only way to determine exact times (to nearest 1/1000th of a second
at least)

frame rate is variable up to the limit you specify (won't go faster than
that)

setInterval is only approximate only (event may take up to 50% longer than
you specify to fire
--
Jeckyl

Jeckyl
10/24/2005 12:00:00 AM
still use onEnterFrame or setInterval

but check the actual time difference since last firing by comparing getTimer
values (which is time in milliseconds since your movie started playing)

Then you can adjust for the inaccuracies of timing for frames and intervals
--
jeckyl

kamyarabhari
10/24/2005 12:44:33 AM
Hi Jeckyl,
tnx for your response, you are a life saver cuz I used setInterval(), anyway,
could ya plz tell me how i can use this function (getTimer) specially in the
following codes instead of setInterval:

_root.flip = (_root.flip ? 0 : 1);
clearInterval(_root.interval);
if((rest!=1)&&(rest!=3)&&(rest!=4)){ //some conditions
_root.interval = setInterval(white_gray, (_root.flip ? t_b : t_f)); }
//white_gray is a function use t_b and t_f as a time one by one[ one time t_b
after that t_f again t_b and so on
AddThis Social Bookmark Button