Packageorg.flintparticles.twoD.particles
Classpublic class Particle2D
InheritanceParticle2D Inheritance Particle Inheritance Object

The Particle class is a set of public properties shared by all particles. It is deliberately lightweight, with only one method. The Initializers and Actions modify these properties directly. This means that the same particles can be used in many different emitters, allowing Particle objects to be reused. Particles are usually created by the ParticleCreator class. This class just simplifies the reuse of Particle objects which speeds up the application.



Public Properties
 PropertyDefined By
 Inheritedage : Number = 0
The age of the particle, in seconds.
Particle
 Inheritedalpha : Number
[read-only]
Particle
  angVelocity : Number = 0
The angular velocity of the particle in radians per second.
Particle2D
 InheritedcollisionRadius : Number = 1
The radius of the particle, for collision approximation
Particle
 Inheritedcolor : uint = 0xFFFFFFFF
The 32bit ARGB color of the particle.
Particle
 InheritedcolorTransform : ColorTransform
[read-only] A ColorTransform object that converts white to the colour of the particle.
Particle
 Inheriteddictionary : Dictionary
[read-only] The dictionary object enables actions and activities to add additional properties to the particle.
Particle
 Inheritedenergy : Number = 1
The energy of the particle.
Particle
 Inheritedimage : * = null
The object used to display the image.
Particle
  inertia : Number
[read-only] The moment of inertia of the particle about its center point
Particle2D
 InheritedisDead : Boolean = false
Whether the particle is dead and should be removed from the stage.
Particle
 Inheritedlifetime : Number = 0
The lifetime of the particle, in seconds.
Particle
 Inheritedmass : Number = 1
The mass of the particle ( 1 is the default ).
Particle
  matrixTransform : Matrix
[read-only] A transformation matrix for the position, scale and rotation of the particle.
Particle2D
  previousX : Number = 0
The x coordinate of the particle prior to the latest update.
Particle2D
  previousY : Number = 0
The y coordinate of the particle prior to the latest update.
Particle2D
  rotation : Number = 0
The rotation of the particle in radians.
Particle2D
 Inheritedscale : Number = 1
The scale of the particle ( 1 is normal size ).
Particle
  sortID : int = -1
The position in the emitter's horizontal spacial sorted array
Particle2D
  velX : Number = 0
The x coordinate of the velocity of the particle in pixels per second.
Particle2D
  velY : Number = 0
The y coordinate of the velocity of the particle in pixels per second.
Particle2D
  x : Number = 0
The x coordinate of the particle in pixels.
Particle2D
  y : Number = 0
The y coordinate of the particle in pixels.
Particle2D
Public Methods
 MethodDefined By
  
Creates a particle.
Particle2D
  
[override] Creates a new particle with all the same properties as this one.
Particle2D
  
initialize():void
[override] Sets the particles properties to their default values.
Particle2D
 Inherited
revive():void
Particle
Property Detail
angVelocityproperty
public var angVelocity:Number = 0

The angular velocity of the particle in radians per second.

inertiaproperty 
inertia:Number  [read-only]

The moment of inertia of the particle about its center point


Implementation
    public function get inertia():Number
matrixTransformproperty 
matrixTransform:Matrix  [read-only]

A transformation matrix for the position, scale and rotation of the particle.


Implementation
    public function get matrixTransform():Matrix
previousXproperty 
public var previousX:Number = 0

The x coordinate of the particle prior to the latest update.

previousYproperty 
public var previousY:Number = 0

The y coordinate of the particle prior to the latest update.

rotationproperty 
public var rotation:Number = 0

The rotation of the particle in radians.

sortIDproperty 
public var sortID:int = -1

The position in the emitter's horizontal spacial sorted array

velXproperty 
public var velX:Number = 0

The x coordinate of the velocity of the particle in pixels per second.

velYproperty 
public var velY:Number = 0

The y coordinate of the velocity of the particle in pixels per second.

xproperty 
public var x:Number = 0

The x coordinate of the particle in pixels.

yproperty 
public var y:Number = 0

The y coordinate of the particle in pixels.

Constructor Detail
Particle2D()Constructor
public function Particle2D()

Creates a particle. Alternatively particles can be reused by using the ParticleCreator to create and manage them. Usually the emitter will create the particles and the user doesn't need to create them.

Method Detail
clone()method
override public function clone(factory:ParticleFactory = null):Particle

Creates a new particle with all the same properties as this one.

Note that the new particle will use the same image object as the one you're cloning. This is fine if the particles are used with a Bitmaprenderer, but if they are used with a DisplayObjectRenderer you will need to replace teh image property with a new image, otherwise only one of the particles (original or clone) will be displayed.

Parameters

factory:ParticleFactory (default = null)

Returns
Particle
initialize()method 
override public function initialize():void

Sets the particles properties to their default values.