# Fps counter as2

**URL:** <https://forum.kirupa.com/t/fps-counter-as2/262008>\
**Category:** Uncategorized\
**Created:** [June 2, 2008, 4:02pm UTC](https://forum.kirupa.com/t/fps-counter-as2/262008 "2008-06-02T16:02:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JBPresents](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@JBPresents](https://forum.kirupa.com/u/JBPresents)\
**Post date:** [June 2, 2008, 4:02pm UTC](https://forum.kirupa.com/t/fps-counter-as2/262008/1 "2008-06-02T16:02:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 2, 2008, 4:18pm UTC](https://forum.kirupa.com/t/fps-counter-as2/262008/2 "2008-06-02T16:18:10Z")

</div>

[Current Frames per Second Tutorial](http://www.technomono.com/tutorials/flash/display-frame-rate/index.php)  
[Current Frames per Second Source 2](http://www.bezzmedia.com/swfspot/samples/flash8/Show_the_Current_Frames_Per_Second)

---

<div class="post-metadata">

**Author:** ![gregmax](https://avatars.discourse-cdn.com/v4/letter/g/ac8455/32.png) [@gregmax](https://forum.kirupa.com/u/gregmax)\
**Post date:** [June 2, 2008, 10:39pm UTC](https://forum.kirupa.com/t/fps-counter-as2/262008/3 "2008-06-02T22:39:00Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![Ph03nix](https://avatars.discourse-cdn.com/v4/letter/p/a8b319/32.png) [@Ph03nix](https://forum.kirupa.com/u/Ph03nix)\
**Post date:** [June 2, 2008, 11:01pm UTC](https://forum.kirupa.com/t/fps-counter-as2/262008/4 "2008-06-02T23:01:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JBPresents](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@JBPresents](https://forum.kirupa.com/u/JBPresents)\
**Post date:** [June 4, 2008, 1:56am UTC](https://forum.kirupa.com/t/fps-counter-as2/262008/5 "2008-06-04T01:56:44Z")

</div>

wow thank you all very much for your help wonderful 🙂 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 🙂

Thanks again very much 🙂

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [June 4, 2008, 8:53am UTC](https://forum.kirupa.com/t/fps-counter-as2/262008/6 "2008-06-04T08:53:55Z")

</div>

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