Packageorg.flintparticles.common.counters
Classpublic class PerformanceAdjusted
InheritancePerformanceAdjusted Inheritance Object
Implements Counter

The PerformanceAdjusted counter causes the emitter to emit particles continuously at a steady rate. It then adjusts this rate downwards if the frame rate is below a target frame rate, until it reaches an emission rate at which the system can maintain the target frame rate.



Public Properties
 PropertyDefined By
  complete : Boolean
[read-only] Indicates if the counter has emitted all its particles.
PerformanceAdjusted
  rateMax : Number
The maximum number of particles to emit per second.
PerformanceAdjusted
  rateMin : Number
The minimum number of particles to emit per second.
PerformanceAdjusted
  running : Boolean
[read-only] Indicates if the counter is currently emitting particles
PerformanceAdjusted
  targetFrameRate : Number
The frame rate that the counter should aim for.
PerformanceAdjusted
Public Methods
 MethodDefined By
  
PerformanceAdjusted(rateMin:Number = 0, rateMax:Number = 0, targetFrameRate:Number = 24)
The constructor creates a PerformanceAdjusted counter for use by an emitter.
PerformanceAdjusted
  
resume():void
Resumes the emitter after a stop
PerformanceAdjusted
  
startEmitter(emitter:Emitter):uint
Initilizes the counter.
PerformanceAdjusted
  
stop():void
Stops the emitter from emitting particles
PerformanceAdjusted
  
updateEmitter(emitter:Emitter, time:Number):uint
Uses the time and current rate to calculate how many particles the emitter should emit now.
PerformanceAdjusted
Property Detail
completeproperty
complete:Boolean  [read-only]

Indicates if the counter has emitted all its particles. For this counter this will always be false.


Implementation
    public function get complete():Boolean
rateMaxproperty 
rateMax:Number

The maximum number of particles to emit per second. the counter will start at this rate and adjust downwards if the frame rate is below the target frame rate.


Implementation
    public function get rateMax():Number
    public function set rateMax(value:Number):void
rateMinproperty 
rateMin:Number

The minimum number of particles to emit per second. The counter will never drop the rate below this value.


Implementation
    public function get rateMin():Number
    public function set rateMin(value:Number):void
runningproperty 
running:Boolean  [read-only]

Indicates if the counter is currently emitting particles


Implementation
    public function get running():Boolean
targetFrameRateproperty 
targetFrameRate:Number

The frame rate that the counter should aim for. Always set this slightly below your actual frame rate since flash will drop frames occasionally even when performance is fine. So, for example, if your movie's frame rate is 30fps and you want to target this rate, set the target rate to 26fps.


Implementation
    public function get targetFrameRate():Number
    public function set targetFrameRate(value:Number):void
Constructor Detail
PerformanceAdjusted()Constructor
public function PerformanceAdjusted(rateMin:Number = 0, rateMax:Number = 0, targetFrameRate:Number = 24)

The constructor creates a PerformanceAdjusted counter for use by an emitter. To add a PerformanceAdjusted counter to an emitter use the emitter's counter property.

Parameters
rateMin:Number (default = 0) — The minimum number of particles to emit per second. The counter will never drop the rate below this value.
 
rateMax:Number (default = 0) — The maximum number of particles to emit per second. The counter will start at this rate and adjust downwards if the frame rate is below the target.
 
targetFrameRate:Number (default = 24) — The frame rate that the counter should aim for. Always set this slightly below your actual frame rate since flash will drop frames occasionally even when performance is fine. So, for example, if your movie's frame rate is 30fps and you want to target this rate, set the target rate to 26fps.
Method Detail
resume()method
public function resume():void

Resumes the emitter after a stop

startEmitter()method 
public function startEmitter(emitter:Emitter):uint

Initilizes the counter. Returns 0 to indicate that the emitter should emit no particles when it starts.

This method is called within the emitter's start method and need not be called by the user.

Parameters

emitter:Emitter — The emitter.

Returns
uint — 0

See also

stop()method 
public function stop():void

Stops the emitter from emitting particles

updateEmitter()method 
public function updateEmitter(emitter:Emitter, time:Number):uint

Uses the time and current rate to calculate how many particles the emitter should emit now. Also monitors the frame rate and adjusts the emission rate down if the frame rate drops below the target.

This method is called within the emitter's update loop and need not be called by the user.

Parameters

emitter:Emitter — The emitter.
 
time:Number — The time, in seconds, since the previous call to this method.

Returns
uint — the number of particles the emitter should create.

See also