Fps counter as2

anyone have an AS2 fps counter class they would be willing to distribute?

Current Frames per Second Tutorial
Current Frames per Second Source 2

This is what I use:

[AS]
Object.prototype.getFPS = function() {
if(signal == true) {
time = getTimer();
} else {
rate = int(1000 / (getTimer() - time));
}
signal = !signal;
return rate;
}
[/AS]

and to have it be displayed, set up a dynamic text field on the stage somewhere, and:

[AS]
text_field.text = "FPS: " + getFPS();
[/AS]

This code is slightly inaccurate but it works if you want to detect slowdown:

onClipEvent (enterFrame) {
t = getTimer();
framerate = Math.round(1000/(t-o));
o = t;
}

framerate is your framerate (obviously)

*note: those three lines in the clipEveent MUST be in that order.

wow thank you all very much for your help wonderful :slight_smile: I plan on recording data and in order to eliminate outliers I have to throw out data on computers that the fps fell below a certain point :slight_smile:

Thanks again very much :slight_smile:

papervision has one of those in the example files if you wished to nick thiers