Flint Particle System Forum - Need help using using displayOjbectZone as velocity with a movieclip Tue, 13 Dec 2011 10:10:05 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher Need help using using displayOjbectZone as velocity with a movieclip http://flintparticles.org/forum/comments.php?DiscussionID=342&Focus=1167#Comment_1167 http://flintparticles.org/forum/comments.php?DiscussionID=342&Focus=1167#Comment_1167 Wed, 14 Apr 2010 18:20:38 +0100 fate0000
import flash.geom.Point;
import flash.display.DisplayObject;
import org.flintparticles.common.counters.*;
import org.flintparticles.common.displayObjects.RadialDot;
import org.flintparticles.common.initializers.*;
import org.flintparticles.twoD.actions.*;
import org.flintparticles.twoD.emitters.Emitter2D;
import org.flintparticles.twoD.initializers.*;
import org.flintparticles.twoD.renderers.*;
import org.flintparticles.twoD.zones.*;

//Emitter emits particles
var emitter:Emitter2D = new Emitter2D();

//Emitter needs a renderer to draw the particles
var renderer:DisplayObjectRenderer = new DisplayObjectRenderer();
//Renderer is a display object so we create it and add it to the stage
addChild( renderer );

//Add emitter to renderer
renderer.addEmitter( emitter );

//Tells how the emitter emits particles. In this case its a steady stream of 100 particles.
emitter.counter = new Steady( 100 );

//This is the image that is going to be the base for our particle.
var imgClass:ImageClass = new ImageClass( RadialDot, 2 );

//Add our image to the emitter
emitter.addInitializer( imgClass );

emitter.addInitializer( new Lifetime( 6 ) );

//Create a line zone above the scene. This is where the particles will emit from.
var zone:LineZone = new LineZone( new Point( -5, -5 ), new Point( 505, -5 ) );
//Create a position and add the zone to the position
var position:Position = new Position( zone );
//Add the position to the emitter.
emitter.addInitializer( position );

//Velocity is specified as a zone, or a place that the particle arrives at in one second.
var zone2:DisplayObjectZone = new DisplayObjectZone(this.ouidooLogo);
var velocity:Velocity = new Velocity( zone2 );
emitter.addInitializer( velocity );

//Takes care of the particles movement after initialization.
var move:Move = new Move();
emitter.addAction( move );

//Start the emitter!
emitter.start();

It seems to be generating particles, but they are not able to get the location of my movie clip it seems as I'm receiving the following error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at org.flintparticles.twoD.zones::DisplayObjectZone/getLocation()
at org.flintparticles.twoD.initializers::Velocity/initialize()
at org.flintparticles.common.emitters::Emitter/createParticle()
at org.flintparticles.common.emitters::Emitter/update()
at org.flintparticles.common.emitters::Emitter/updateEventListener()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at org.flintparticles.common.utils::FrameUpdater/frameUpdate()

Any help on how I can get my particles to "land" on my movieclip would be greatly appreciated.

Thank you for looking! ]]>
Need help using using displayOjbectZone as velocity with a movieclip http://flintparticles.org/forum/comments.php?DiscussionID=342&Focus=1168#Comment_1168 http://flintparticles.org/forum/comments.php?DiscussionID=342&Focus=1168#Comment_1168 Wed, 14 Apr 2010 20:34:28 +0100 fate0000
import flash.geom.Point;
import flash.display.DisplayObject;
import org.flintparticles.common.counters.*;
import org.flintparticles.common.displayObjects.RadialDot;
import org.flintparticles.common.initializers.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.common.energyEasing.*;
import org.flintparticles.twoD.actions.*;
import org.flintparticles.twoD.emitters.Emitter2D;
import org.flintparticles.twoD.initializers.*;
import org.flintparticles.twoD.renderers.*;
import org.flintparticles.twoD.zones.*;

//Emitter emits particles
var emitter:Emitter2D = new Emitter2D();

//Emitter needs a renderer to draw the particles
var renderer:DisplayObjectRenderer = new DisplayObjectRenderer();
//Renderer is a display object so we create it and add it to the stage
addChild( renderer );

//Add emitter to renderer
renderer.addEmitter( emitter );

//Tells how the emitter emits particles. In this case its a steady stream of 100 particles.
emitter.counter = new Steady( 100 );

//This is the image that is going to be the base for our particle.
var imgClass:ImageClass = new ImageClass( RadialDot, 2 );

//Add our image to the emitter
emitter.addInitializer( imgClass );

emitter.addInitializer( new Lifetime( 6 ) );

//Create a line zone above the scene. This is where the particles will emit from.
var zone:LineZone = new LineZone( new Point( -5, -5 ), new Point( 505, -5 ) );
//Create a position and add the zone to the position
var position:Position = new Position( zone );
//Add the position to the emitter.
emitter.addInitializer( position );

//specify easing
var easing:Function = Cubic.easeInOut;

//Takes care of the particles movement after initialization.
emitter.addAction(new Age(easing));
emitter.addAction(new TweenToZone(new DisplayObjectZone(this.ouidooLogo, renderer)));

//Start the emitter!
emitter.start(); ]]>
Need help using using displayOjbectZone as velocity with a movieclip http://flintparticles.org/forum/comments.php?DiscussionID=342&Focus=1175#Comment_1175 http://flintparticles.org/forum/comments.php?DiscussionID=342&Focus=1175#Comment_1175 Sat, 17 Apr 2010 14:10:24 +0100 Richard TweenToZone action. ]]>