Flint Particle System Forum - Need help using using displayOjbectZone as velocity with a movieclip2011-12-13T10:33:35+00:00http://flintparticles.org/forum/
Lussumo Vanilla & Feed Publisher
Need help using using displayOjbectZone as velocity with a moviecliphttp://flintparticles.org/forum/comments.php?DiscussionID=342&Focus=1167#Comment_11672010-04-14T18:20:38+01:002011-12-13T10:33:35+00:00fate0000http://flintparticles.org/forum/account.php?u=350
My ultimate goal is to have particles originate from a location and fill in the area specified by an instance of a movieclip that currently resides on my stage. I started off with the snow example ...
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 moviecliphttp://flintparticles.org/forum/comments.php?DiscussionID=342&Focus=1168#Comment_11682010-04-14T20:34:28+01:002011-12-13T10:33:35+00:00fate0000http://flintparticles.org/forum/account.php?u=350
I cleared up a few things for myself and got my desired effect with the following code. One of my biggest problems was that I didn't specify the render in the displayobjectzone declaration. ...
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 moviecliphttp://flintparticles.org/forum/comments.php?DiscussionID=342&Focus=1175#Comment_11752010-04-17T14:10:24+01:002011-12-13T10:33:35+00:00Richardhttp://flintparticles.org/forum/account.php?u=1
To get the particles to fill in the area of your display object, you may be better off using a TweenToZone action.
TweenToZone action.]]>