Please upgrade your flash version.

Getting Started

There's three ways to use the Pulse Particle system. A full object-orientated model for complete control over the system, a simpler Object syntax, and a very easy to use Flash extension. Those three methods are described below.

Full Object Orientated Syntax



[SWF(backgroundColor="#000000", frameRate="30", width="500", height="350")] 
public class ObjectOrientatedExample extends Sprite
{
    public function ObjectOrientatedExample()
    {
        super();
        
        
        /*
          First, set the root sprite to use for particles.  You can set root sprites for each emitter
          as well, but they'll default to this if you don't.
        */
        PulseEngine.instance.root = this;
    
        /*
        Next, we set up our list of rules.  These rules define the behavior for the particles.
        
        The BoundingBoxRule causes particles to bounce when they hit the edges of the box.
        The MovementRule causes particles to move in according to their angle and speed.
        
        Usually, you'll want to add a DeathRule to particles will die, but we're going to let
        them bounce around forever in this example.
        
        Other rules can be found in com.roguedevelopment.pulse.rule.*
        */
        var rules:Array = [];									
        rules.push( new BoundingBoxRule(new Rectangle( 0,0,500,350 )) );  
        rules.push( new MovementRule() );
    
        /*
        An IParticleFactory (of which GenericFactory implements) creates particles.  It behaves just
        like the ClassFactory class with a little added functionality.
        
        You can pass it any of the particle classes (com.roguedevelopment.pulse.particle.*) or create your own.
        */
        var particleFactory:GenericFactory = new GenericFactory( DotParticle, rules , {});
        
        /*
          An emitter uses the factory to create particles.  Here we're setting up a GenericEmitter to emit
          20 particles per second, setting the factory to create the particles, and setting up some initial
          parameters for those particles.  The GenericEmitter can randomize some parameters such as angle
          and speed.
        */ 						
        var emitter:GenericEmitter = new GenericEmitter( 20 );
        emitter.setFactory( particleFactory );
        emitter.minSpeed = 50;
        emitter.maxSpeed = 95;
        emitter.minAngle = 0;
        emitter.maxAngle = 360;
        emitter.x = 10;
        emitter.y = 10;
        
        /* Since we didn't have a DeathRule, we'll limit the number of particles created to 100.  This is a
           creation limit, not a "currently active" limit.
        */			  
        emitter.particleLimit = 100;
        
        /*
            And lastly, we start up the emitter.
        */
        emitter.start(); 
    
        
        
    }
    
}

    

Simple Object Syntax

    
[SWF(backgroundColor="#000000", frameRate="30", width="500", height="350")] 
public class SimpleObjectSyntax extends Sprite
{
    public function SimpleObjectSyntax()
    {
        super();
        
        /*
          First, set the root sprite to use for particles.  You can set root sprites for each emitter
          as well, but they'll default to this if you don't.
        */
        PulseEngine.instance.root = this;
        
        /*
         Next, we'll use the SimpleParticles class to create a new particle emitter.  The parameter passed 
         in is a simplified object syntax that translates into creating an Emitter, a Factory, and a set of 
         rules.  You can use the particle explorer at:
         
         http://rogue-development.com/pulse/explorer/#
         
         To create this configuration object in an interactive environment.
         
         */
        SimpleParticles.createEmitter( {pps:10,x:22, y:25, 
                                        width:1, height:1,size:1, 
                                        color:0xff0000, movement:true, 
                                        minSpeed:100, maxSpeed:300, 
                                        minAngle:0, maxAngle:360, 
                                        minScale:1, maxScale:1, 
                                        bound:[0,0,500,350], limit:100,
                                        pointSwarm:[250,17]											
                                        } );

        /*
          You can create multiple emitter, either with similar or completely different 
          behavior to create interesting effects.
        */
        SimpleParticles.createEmitter( {pps:10,x:22, y:225, 
                                        width:1, height:1,size:1, 
                                        color:0x00ff00, movement:true, 
                                        minSpeed:100, maxSpeed:300, 
                                        minAngle:0, maxAngle:360, 
                                        minScale:1, maxScale:1, 
                                        bound:[0,0,500,350], limit:100,
                                        pointSwarm:[250,17]} );

        SimpleParticles.createEmitter( {pps:10,x:480, y:25, 
                                        width:1, height:1,size:1, 
                                        color:0x0000ff, movement:true, 
                                        minSpeed:100, maxSpeed:300, 
                                        minAngle:0, maxAngle:360, 
                                        minScale:1, maxScale:1, 
                                        bound:[0,0,500,350], limit:100,
                                        pointSwarm:[250,17]} );

        SimpleParticles.createEmitter( {pps:10,x:480, y:225, 
                                        width:1, height:1,size:1, 
                                        color:0xffff00, movement:true, 
                                        minSpeed:100, maxSpeed:300, 
                                        minAngle:0, maxAngle:360, 
                                        minScale:1, maxScale:1, 
                                        bound:[0,0,500,350], limit:100,
                                        pointSwarm:[250,17]} );
        
    }
    
}
    

Flash Authoring Environment

See the first video tutorial below for details, but here's the quick way to get started with particle effects in Flash.

  1. Download & install Flash MXP package
  2. Create a MovieClip in Flash to represent one particle, turn on "Export For Actionscript"
  3. Go to the Particle Explorer, and determine the particle behaviors
  4. Copy the config string from the particle explorer
  5. In flash, drag the ParticleEmitter flash component from your components tab to your stage.
  6. Edit the properties of the emitter.
    1. Set the config param to the string the explorer gave you
    2. Set pps to the number of Particles Per Second you want
    3. Type the name of your particle movie clip in the "movieclipName" param
  7. Export your flash movie and enjoy your particles.

Please see these video tutorials for more instructions on how to use this.