[color=Red]**Could you debug **[/color]my METHOD 2?? (please see Line#11 (it’s Line#20 in the attachment) or the statement
if(x>framerate) )
It has two methods of knowing the frame rate…
Method1: measures only ONE ITERATION of the whole onEnterFrame method regardless of frame rate because it EXPLICITLY multiplies it with the framerate variable (assuming you set 12 on your movie).
Method 2: I’m not sure if line#11 (line#20 in fla) should be
if(x **[color=Red]==[/color]**framerate)
but if i did that, it seems that the estimated frame rate is about 30 ms shorter than the expected 1000 ms. But if I use the
“<” operator, it’s closer to method 1.
HELP…
var x=1;
var framerate = 12;
function EventHandlerRate(){
var currenttime = getTimer();
if(x==1){
starttime=currenttime;
}
timeElapse = currenttime - this.prevTime;
trace("METHOD1: "+timeElapse*framerate+" milliseconds");
this.prevTime=currenttime;
if(x>framerate){
txt1 = "START : ";
txt2 = "END : ";
txt3 = "TIMEELAPSE is ";
endtime = getTimer();
trace("
"
+"==============================
"
+"METHOD 2:
"
+"==============================
"
+txt1 + starttime + "
"
+ txt2 + endtime + "
"
+ txt3 + (endtime - starttime)
+"
");
x=0;
}
++x;
}
this.onEnterFrame = EventHandlerRate;