Packagecom.desuade.partigen.pools
Classpublic class Pool
InheritancePool Inheritance Object
Subclasses BasicPool, NullPool

Language Version : ActionScript 3
Since : 07.05.2009
Runtime Versions : AIR 1.0, Flash Player 9.0.0

These hold and manage the actual particle objects in memory. This handles the creation of particle objects and is controlled internally.



Public Properties
 PropertyDefined By
  length : int
[read-only] Returns the total amount of particles in the pool.
Pool
  onLastParticle : Function
The method to call each time the last living particle returns to the pool.
Pool
  particleClass : Class
[read-only] Gets the class of particle the pool creates.
Pool
  particles : Dictionary
[read-only] A Dictionary object of all the current "living" particles.
Pool
Public Methods
 MethodDefined By
  
Pool(particleClass:Class)
Creates a Pool to store particle objects.
Pool
  
Adds a new particle to the Pool.
Pool
  
purge():void
This does nothing for Sweep and Null pools.
Pool
  
removeParticle(particle:*):void
Removes the specified particle from the Pool. If you're trying to remove a particle through custom code, it is recommended to simply call particle.kill() than to work directly with the pool.
Pool
  
setClass(particleClass:Class):void
This sets the particleClass to the new class and deals with reseting the internal pool.
Pool
Property Detail
lengthproperty
length:int  [read-only]

Returns the total amount of particles in the pool.


Implementation
    public function get length():int
onLastParticleproperty 
onLastParticle:Function

The method to call each time the last living particle returns to the pool.


Implementation
    public function get onLastParticle():Function
    public function set onLastParticle(value:Function):void
particleClassproperty 
particleClass:Class  [read-only]

Gets the class of particle the pool creates.


Implementation
    public function get particleClass():Class
particlesproperty 
particles:Dictionary  [read-only]

A Dictionary object of all the current "living" particles. The key|value pair is particle|particle.id.


Implementation
    public function get particles():Dictionary
Constructor Detail
Pool()Constructor
public function Pool(particleClass:Class)

Creates a Pool to store particle objects. This base class should not be created, as it offers no direct functionality.

Parameters
particleClass:Class — The class of particle the pool will create.
Method Detail
addParticle()method
public function addParticle():IBasicParticle

Adds a new particle to the Pool.

Returns
IBasicParticle — The particle created.
purge()method 
public function purge():void

This does nothing for Sweep and Null pools.

removeParticle()method 
public function removeParticle(particle:*):void

Removes the specified particle from the Pool.

If you're trying to remove a particle through custom code, it is recommended to simply call particle.kill() than to work directly with the pool.

Parameters

particle:* — The particle to remove.

setClass()method 
public function setClass(particleClass:Class):void

This sets the particleClass to the new class and deals with reseting the internal pool.

Parameters

particleClass:Class