package { import flash.display.MovieClip; //import import FPS; import flash.events.Event; public class FPSExample extends MovieClip{ public static var fps:FPS; public function FPSExample() { //create instance fps = new FPS(); //add it there where you want it addChild(fps); //set text color fps.textColor="0xFF"; //set FPS graph line color fps.fpsColor="0xFF0000"; //set sizes fps.graphWidth=200; fps.graphHeight=50; //set graph background color fps.graphBackColor = 0x55000000; //call this before you can use it fps.init(); addEventListener(Event.ENTER_FRAME,frame); //use add to graph to make some labels drawn on graph, select color for them fps.addToGraph("test1",0xff); fps.addToGraph("test2",0xff00); } public function frame(e:Event){ //call this to clear previous time step data fps.clear(); //here how to count time for a segment of code, just start counting at start of it and end it one the end fps.startCounting("test1"); var i:uint=300000; while(i>0){ i--; } fps.stopCounting("test1"); fps.startCounting("test2"); i=300000; while(i>0){ i--; } fps.stopCounting("test2"); //notice that you can position them anyway you like, like here test1 code you want to count is separated trough programm, fps.startCounting("test1"); i=600000; while(i>0){ i--; } fps.stopCounting("test1"); //as I said any way you like, they can overlap too, just don't forget closing each opened one fps.startCounting("test1"); i=600000; while(i>0){ i--; } fps.startCounting("test2"); i=300000; while(i>0){ i--; } fps.stopCounting("test1"); i=300000; while(i>0){ i--; } fps.stopCounting("test2"); } } }