Packageorg.flixel.system
Classpublic class FlxMonitor
InheritanceFlxMonitor Inheritance Object

FlxMonitor is a simple class that aggregates and averages data. Flixel uses this to display the framerate and profiling data in the developer console. It's nice for keeping track of things that might be changing too fast from frame to frame.



Public Properties
 PropertyDefined By
  full : Boolean
Shows whether the monitor has been filled all the way yet or not.
FlxMonitor
Protected Properties
 PropertyDefined By
  _data : Array
An array to hold all the data we are averaging.
FlxMonitor
  _itr : uint
Keeps track of where we are in the array.
FlxMonitor
  _last : Number
Just stores the last number we added.
FlxMonitor
  _size : uint
Stores the requested size of the monitor array.
FlxMonitor
Public Methods
 MethodDefined By
  
FlxMonitor(Size:uint, Default:Number = 0)
Creates the monitor array and sets the size.
FlxMonitor
  
add(Data:Number):void
Adds an entry to the array of data.
FlxMonitor
  
average():Number
Averages the value of all the numbers in the monitor window.
FlxMonitor
  
clear(Default:Number = 0):void
Goes through and sets every entry in the monitor to Default (0).
FlxMonitor
  
last():Number
Retrieves the last value added to the monitor.
FlxMonitor
  
total():Number
Adds up all the values in the monitor window.
FlxMonitor
  
trend():Number
Tells you if the monitor window is charting up or down.
FlxMonitor
Property Detail
_dataproperty
protected var _data:Array

An array to hold all the data we are averaging.

_itrproperty 
protected var _itr:uint

Keeps track of where we are in the array.

_lastproperty 
protected var _last:Number

Just stores the last number we added.

_sizeproperty 
protected var _size:uint

Stores the requested size of the monitor array.

fullproperty 
public var full:Boolean

Shows whether the monitor has been filled all the way yet or not.

Constructor Detail
FlxMonitor()Constructor
public function FlxMonitor(Size:uint, Default:Number = 0)

Creates the monitor array and sets the size.

Parameters
Size:uint — The desired size - more entries means a longer window of averaging.
 
Default:Number (default = 0) — The default value of the entries in the array (0 by default).
Method Detail
add()method
public function add(Data:Number):void

Adds an entry to the array of data.

Parameters

Data:Number — The value you want to track and average.

average()method 
public function average():Number

Averages the value of all the numbers in the monitor window.

Returns
Number — The average value of all the numbers in the monitor window.
clear()method 
public function clear(Default:Number = 0):void

Goes through and sets every entry in the monitor to Default (0).

Parameters

Default:Number (default = 0) — The new value you want ever entry to have.

last()method 
public function last():Number

Retrieves the last value added to the monitor.

Returns
Number
total()method 
public function total():Number

Adds up all the values in the monitor window.

Returns
Number — The total value of all the entries in the monitor.
trend()method 
public function trend():Number

Tells you if the monitor window is charting up or down.

Returns
Number — The difference between the oldest number in the monitor and the average.