Packageorg.flintparticles.twoD.emitters
Classpublic class Emitter2D
InheritanceEmitter2D Inheritance Emitter Inheritance flash.events.EventDispatcher
Subclasses Emitter2D

The Emitter class manages the creation and ongoing state of particles. It uses a number of utility classes to customise its behaviour.

An emitter uses Initializers to customise the initial state of particles that it creates, their position, velocity, color etc. These are added to the emitter using the addInitializer method.

An emitter uses Actions to customise the behaviour of particles that it creates, to apply gravity, drag, fade etc. These are added to the emitter using the addAction method.

An emitter uses Activities to customise its own behaviour in an ongoing manner, to make it move or rotate.

An emitter uses a Counter to know when and how many particles to emit.

An emitter uses a Renderer to display the particles on screen.

All timings in the emitter are based on actual time passed, not on frames.

Most functionality is best added to an emitter using Actions, Initializers, Activities, Counters and Renderers. This offers greater flexibility to combine behaviours witout needing to subclass the Emitter itself.

The emitter also has position properties - x, y, rotation - that can be used to directly affect its location in the particle system.



Public Properties
 PropertyDefined By
 Inheritedactions : Vector.<Action>
The array of all actions being used by this emitter.
Emitter
 Inheritedactivities : Vector.<Activity>
The array of all actions being used by this emitter.
Emitter
 Inheritedcounter : Counter
The Counter for the Emitter.
Emitter
  defaultParticleFactory : ParticleFactory
[static] [read-only] The default particle factory used to manage the creation, reuse and destruction of particles.
Emitter2D
 InheritedfixedFrameTime : Number
Indicates a fixed time (in seconds) to use for every frame.
Emitter
 Inheritedinitializers : Vector.<Initializer>
The array of all initializers being used by this emitter.
Emitter
 InheritedmaximumFrameTime : Number
The maximum duration for a single update frame, in seconds.
Emitter
 InheritedparticleFactory : ParticleFactory
This is the particle factory used by the emitter to create and dispose of particles.
Emitter
 Inheritedparticles : Vector.<Particle>
The collection of all particles being managed by this emitter.
Emitter
 InheritedparticlesArray : Array
[read-only] The actual array of particles used internally by this emitter.
Emitter
  rotation : Number
Indicates the rotation of the Emitter, in degrees, within the particle system's coordinate space.
Emitter2D
  rotRadians : Number
Indicates the rotation of the Emitter, in radians, within the particle system's coordinate space.
Emitter2D
 Inheritedrunning : Boolean
[read-only] Indicates if the emitter is currently running.
Emitter
  spaceSort : Boolean = false
Identifies whether the particles should be arranged into spacially sorted arrays - this speeds up proximity testing for those actions that need it.
Emitter2D
 InheriteduseInternalTick : Boolean
Indicates whether the emitter should manage its own internal update tick.
Emitter
  x : Number
Indicates the x coordinate of the Emitter within the particle system's coordinate space.
Emitter2D
  y : Number
Indicates the y coordinate of the Emitter within the particle system's coordinate space.
Emitter2D
Protected Properties
 PropertyDefined By
 Inherited_dispatchCounterComplete : Boolean = false
Indicates if the emitter should dispatch a counterComplete event at the end of the next update cycle.
Emitter
 Inherited_processLastFirst : Boolean = false
Used to alternate the direction in which the particles in the particles array are processed, to iron out errors from always processing them in the same order.
Emitter
Public Methods
 MethodDefined By
  
The constructor creates an emitter.
Emitter2D
 Inherited
addAction(action:Action):void
Adds an Action to the Emitter.
Emitter
 Inherited
addActivity(activity:Activity):void
Adds an Activity to the Emitter.
Emitter
 Inherited
addInitializer(initializer:Initializer):void
Adds an Initializer object to the Emitter.
Emitter
 Inherited
addParticle(particle:Particle, applyInitializers:Boolean = false):void
Add a particle to the emitter.
Emitter
 Inherited
addParticles(particles:Vector.<Particle>, applyInitializers:Boolean = false):void
Adds existing particles to the emitter.
Emitter
 Inherited
Used by counters to tell the emitter to dispatch a counter complete event.
Emitter
 Inherited
hasAction(action:Action):Boolean
Detects if the emitter is using a particular action or not.
Emitter
 Inherited
hasActionOfType(actionClass:Class):Boolean
Detects if the emitter is using an action of a particular class.
Emitter
 Inherited
hasActivity(activity:Activity):Boolean
Detects if the emitter is using a particular activity or not.
Emitter
 Inherited
hasActivityOfType(activityClass:Class):Boolean
Detects if the emitter is using an activity of a particular class.
Emitter
 Inherited
hasInitializer(initializer:Initializer):Boolean
Detects if the emitter is using a particular initializer or not.
Emitter
 Inherited
hasInitializerOfType(initializerClass:Class):Boolean
Detects if the emitter is using an initializer of a particular class.
Emitter
 Inherited
Kill all the particles on this emitter.
Emitter
 Inherited
pause():void
Pauses the emitter.
Emitter
 Inherited
removeAction(action:Action):void
Removes an Action from the Emitter.
Emitter
 Inherited
removeActivity(activity:Activity):void
Removes an Activity from the Emitter.
Emitter
 Inherited
removeInitializer(initializer:Initializer):void
Removes an Initializer from the Emitter.
Emitter
 Inherited
removeParticle(particle:Particle):Boolean
Remove a particle from this emitter.
Emitter
 Inherited
removeParticles(particles:Vector.<Particle>):void
Remove a collection of particles from this emitter.
Emitter
 Inherited
resume():void
Resumes the emitter after a pause.
Emitter
 Inherited
runAhead(time:Number, frameRate:Number = 10):void
Makes the emitter skip forwards a period of time with a single update.
Emitter
 Inherited
start():void
Starts the emitter.
Emitter
 Inherited
stop():void
Stops the emitter, killing all current particles and returning them to the particle factory for reuse.
Emitter
 Inherited
update(time:Number):void
Used to update the emitter.
Emitter
Protected Methods
 MethodDefined By
 Inherited
Emitter
  
initParticle(particle:Particle):void
[override] Used internally to initialise the position and rotation of a particle relative to the emitter.
Emitter2D
  
[override] Used internally and in derived classes to update the emitter.
Emitter2D
Events
 Event Summary Defined By
 InheritedDispatched when the counter for the particle system has finished its cycle and so the system will not emit any more particles unless the counter is changed or restarted.Emitter
 InheritedDispatched when an emitter attempts to update the particles' state but it contains no particles.Emitter
 InheritedDispatched when the particle system has updated and the state of the particles has changed.Emitter
 InheritedDispatched when a pre-existing particle is added to the emitter.Emitter
 InheritedDispatched when a particle is created and has just been added to the emitter.Emitter
 InheritedDispatched when a particle dies and is about to be removed from the system.Emitter
Property Detail
defaultParticleFactoryproperty
defaultParticleFactory:ParticleFactory  [read-only]

The default particle factory used to manage the creation, reuse and destruction of particles.


Implementation
    public static function get defaultParticleFactory():ParticleFactory
rotationproperty 
rotation:Number

Indicates the rotation of the Emitter, in degrees, within the particle system's coordinate space.


Implementation
    public function get rotation():Number
    public function set rotation(value:Number):void
rotRadiansproperty 
rotRadians:Number

Indicates the rotation of the Emitter, in radians, within the particle system's coordinate space.


Implementation
    public function get rotRadians():Number
    public function set rotRadians(value:Number):void
spaceSortproperty 
public var spaceSort:Boolean = false

Identifies whether the particles should be arranged into spacially sorted arrays - this speeds up proximity testing for those actions that need it.

xproperty 
x:Number

Indicates the x coordinate of the Emitter within the particle system's coordinate space.


Implementation
    public function get x():Number
    public function set x(value:Number):void
yproperty 
y:Number

Indicates the y coordinate of the Emitter within the particle system's coordinate space.


Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor Detail
Emitter2D()Constructor
public function Emitter2D()

The constructor creates an emitter.

Method Detail
initParticle()method
override protected function initParticle(particle:Particle):void

Used internally to initialise the position and rotation of a particle relative to the emitter.

Parameters

particle:Particle

sortParticles()method 
override protected function sortParticles():void

Used internally and in derived classes to update the emitter.