Packagecom.desuade.partigen.pools
Classpublic class BasicPool
InheritanceBasicPool Inheritance Pool Inheritance Object

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

This is a basic particle pool that uses actual object pooling to reuse particles.



Public Properties
 PropertyDefined By
  expandSize : int
The starting size and rate of expansion of the object pool
BasicPool
 Inheritedlength : int
[read-only] Returns the total amount of particles in the pool.
Pool
  onLastParticle : Function
[override] The method to call each time the last living particle returns to the pool.
BasicPool
 InheritedparticleClass : Class
[read-only] Gets the class of particle the pool creates.
Pool
 Inheritedparticles : Dictionary
[read-only] A Dictionary object of all the current "living" particles.
Pool
Public Methods
 MethodDefined By
  
BasicPool(particleClass:Class, expandSize:int = 50)
This creates a basic particle pool using object pooling.
BasicPool
  
[override] Adds a new particle to the Pool.
BasicPool
  
purge():void
[override] This clears all particles in the object pool and will not check any currently living particles back into the object pool.
BasicPool
  
removeParticle(particle:*):void
[override] 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.
BasicPool
  
setClass(particleClass:Class):void
[override] This sets the particleClass to the new class and deals with reseting the internal pool.
BasicPool
Property Detail
expandSizeproperty
public var expandSize:int

The starting size and rate of expansion of the object pool

onLastParticleproperty 
onLastParticle:Function[override]

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
Constructor Detail
BasicPool()Constructor
public function BasicPool(particleClass:Class, expandSize:int = 50)

This creates a basic particle pool using object pooling.

Parameters
particleClass:Class — The baseParticleClass to use for the particles
 
expandSize:int (default = 50) — The size of each expansion for the object pool
Method Detail
addParticle()method
override public function addParticle():IBasicParticle

Adds a new particle to the Pool.

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

This clears all particles in the object pool and will not check any currently living particles back into the object pool.

removeParticle()method 
override 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 
override public function setClass(particleClass:Class):void

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

Parameters

particleClass:Class