Packagecom.desuade.partigen.emitters
Classpublic dynamic class Emitter
InheritanceEmitter Inheritance BasicEmitter Inheritance flash.display.Sprite
Subclasses IDEEmitter

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

This creates particles and holds the controllers to configure the effects.



Public Properties
 PropertyDefined By
 Inheritedactive : Boolean
[read-only] This is true if the emitter is currently emitting.
BasicEmitter
  angle : int = 0
This is the angle used by ParticlePhysicsControllers on new particles.
Emitter
  angleSpread : * = 0
This is the spread for the angle, to create a random range for ParticlePhysicsControllers.
Emitter
 Inheritedburst : int = 1
This is the amount of particles to be created on each emission.
BasicEmitter
 InheritedcacheParticleAsBitmap : Boolean = false
This will set "cacheAsBitmap = true" on all created particles. Test using this vs groupBitmap - as performance will vary based on each effect. Also test this with BitmapRenderer, as it may vary the effect and performance.
BasicEmitter
  controllers : Object
This object holds the EmitterController and the ParticleController. They are accessible as follows: controllers.emitter and controllers.particle These controllers are what is used to configure particles and the way the behave, as well as properties for the emitter itself.
Emitter
 InheritedenableEvents : Boolean = false
Enable particle BORN and DIED events.
BasicEmitter
 Inheritedeps : Number
This stands for "emissions per second".
BasicEmitter
 InheritedforceVariety : Boolean = false
This forces pooled particles to rebuild their groups and controllers to eliminate any possible repetition or error at the cost of performance. Set this to true if you plan on making changes to the emitter while it's running.
BasicEmitter
 InheritedgroupAmount : int = 1
This controls how may particles are made in a "particle group".
BasicEmitter
 InheritedgroupBitmap : Boolean = false
This will create a new Bitmap object for the particle instead of the direct display object.
BasicEmitter
 InheritedgroupProximity : int = 0
This determines the maximum distance away from the center of the group to create new particles.
BasicEmitter
 Inheritedid : int
[read-only] The unique id of the emitter.
BasicEmitter
 Inheritedlife : Number = 1
This is the duration in seconds a particle will exist for. If the value is 0, the particle will live forever.
BasicEmitter
 InheritedlifeSpread : * = 0
This is the spread for particle lives.
BasicEmitter
 Inheritedparticle : Class
This is the class used to create new particles from.
BasicEmitter
 InheritedparticleBaseClass : Class
This is the base class to used for all created particles. When the pools create particle objects, they use this.
BasicEmitter
 InheritedparticleBlendMode : String = normal
This defines the blendmode for each particle created. Choices: "add", "alpha", "darken", "difference", "erase", "hardlight", "invert", "layer", "lighten", "multiply", "normal", "overlay", "screen", "subtract" Note: PixelRenderer will assume the blendmode of all particles/pixels is the same.
BasicEmitter
 InheritedparticleFilters : Array
This is an array of filters that gets applied to each particle as it's born.
BasicEmitter
 Inheritedpool : Pool
This is the Pool to use to store and manage the actual particle objects.
BasicEmitter
 Inheritedrenderer : Renderer
The Renderer to use for created particles.
BasicEmitter
Public Methods
 MethodDefined By
  
This creates a new Emitter. This is the standard, full-featured emitter that's recommended to use.
Emitter
 Inherited
createParticleBitmap(padding:int = 0):void
This creates the main bitmapdata object used when groupBitmap == true.
BasicEmitter
 Inherited
emit(burst:int = 1):void
This method creates new particles each time it's called.
BasicEmitter
  
fromXML(xml:XML, reset:Boolean = true, renderer:Boolean = false):*
[override] This configures the emitter based on the XML, and adds any controllers (if available)
Emitter
 Inherited
getPrefetchLifeArray(time:Number):Array
This creates an array of particle's life values, both original and current, based on the eps/burst and supplied time value as it would if the emitter was running for the time duration.
BasicEmitter
 Inherited
This kills all currently existing particles in the pool created by this emitter
BasicEmitter
 Inherited
prefetch(time:Number):void
This prefetches (and creates) the particles that would have existed if the emitter was running for the given time.
BasicEmitter
  
reset():void
[override] This resets the emitter to the defaults and purges the pool
Emitter
  
start(time:Number = 0, startcontrollers:Boolean = true):void
[override] Starts the emitter.
Emitter
  
stop(stopcontrollers:Boolean = true, purge:Boolean = true):void
[override] This stops the emitter.
Emitter
  
toXML():XML
[override] This generates an XML object representing the entire emitter
Emitter
Protected Methods
 MethodDefined By
  
createParticle(totalLife:Number = 0, remainingLife:Number = 0):IBasicParticle
[override]
Emitter
Property Detail
angleproperty
public var angle:int = 0

This is the angle used by ParticlePhysicsControllers on new particles. This only effects properties that are using physics, NOT ParticleTweenControllers.

The default value is 0, which is pointing "right". 90 is "up", 180 is "left", and 270 is "down".

angleSpreadproperty 
public var angleSpread:* = 0

This is the spread for the angle, to create a random range for ParticlePhysicsControllers.

controllersproperty 
public var controllers:Object

This object holds the EmitterController and the ParticleController.

They are accessible as follows: controllers.emitter and controllers.particle

These controllers are what is used to configure particles and the way the behave, as well as properties for the emitter itself.

Constructor Detail
Emitter()Constructor
public function Emitter()

This creates a new Emitter.

This is the standard, full-featured emitter that's recommended to use. It offers an innovative and extremely powerful way to configure particle effects, based on MotionControllers from the Motion Package.

An emitter is the object that controls the creation of new particles, rather than calling new Particle() directly, using emitters makes creating particle effects easy.

Particles are (generally) spawned from the current location of the emitter, unless specifically overridden by x,y,z controller start values.

The management of the actual particle objects are handled by Pools, and how they are displayed on screen by Renderers. Both can be shared by multiple emitters.

Method Detail
createParticle()method
override protected function createParticle(totalLife:Number = 0, remainingLife:Number = 0):IBasicParticle

Parameters

totalLife:Number (default = 0)
 
remainingLife:Number (default = 0)

Returns
IBasicParticle
fromXML()method 
override public function fromXML(xml:XML, reset:Boolean = true, renderer:Boolean = false):*

This configures the emitter based on the XML, and adds any controllers (if available)

Parameters

xml:XML — The XML object to use to configure the emitter
 
reset:Boolean (default = true) — Resets the emitter before applying XML and also purges the pool
 
renderer:Boolean (default = false) — If true, this creates (and overwrites) the emitter's renderer with one from XML. If this is a BitmapRenderer, be sure to call resize(width, height) on it after the XML. Also, for BasicEmitters only (to save file size), you must create a reference to the Renderers you're going to use before using it through XML (for Flash to include the classes). This can be done easily as var renderers:Array = [NullRenderer, StandardRenderer, BitmapRenderer]; (this is done already for the Emitter and IDEEmitter classes).

Returns
* — The emitter object (for chaining)
reset()method 
override public function reset():void

This resets the emitter to the defaults and purges the pool

start()method 
override public function start(time:Number = 0, startcontrollers:Boolean = true):void

Starts the emitter. Passing a time will 'prefetch' particles as if the emitter had already been running for the given amount of time. If you only want to emit once, or at your own rate, use emit()

It also, by default, starts all the controllers managed by the EmitterController.

Parameters

time:Number (default = 0) — Starts the emitter as if it's already been running for this duration (in seconds).
 
startcontrollers:Boolean (default = true) — This starts all MotionControllers managed by the EmitterController.

stop()method 
override public function stop(stopcontrollers:Boolean = true, purge:Boolean = true):void

This stops the emitter. It also, by default, stops all the controllers managed by the EmitterController.

Parameters

stopcontrollers:Boolean (default = true) — This stops all MotionControllers managed by the EmitterController.
 
purge:Boolean (default = true) — This purges the pool when all particles have finished safely.

toXML()method 
override public function toXML():XML

This generates an XML object representing the entire emitter

Returns
XML — An XML object representing the emitter