Flint Particle System Forum - particles composed of different elements Tue, 13 Dec 2011 06:28:28 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher particles composed of different elements http://flintparticles.org/forum/comments.php?DiscussionID=333&Focus=1138#Comment_1138 http://flintparticles.org/forum/comments.php?DiscussionID=333&Focus=1138#Comment_1138 Mon, 08 Mar 2010 22:06:55 +0000 akrobata79
I am messing with the flocking example from your site
and basically all i'm trying to achieve at this point is have different images flying around, now I actually got them to fly around but i get this error:

TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at org.flintparticles.twoD.renderers::DisplayObjectRenderer/addParticle()
at org.flintparticles.common.renderers::SpriteRendererBase/particleAdded()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at org.flintparticles.common.emitters::Emitter/createParticle()
at org.flintparticles.common.emitters::Emitter/start()


now here's the code

import org.flintparticles.twoD.particles.*;
import org.flintparticles.twoD.particles.Particle2DUtils;
import org.flintparticles.common.counters.*;
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.*;

var emitter:Emitter2D = new Emitter2D();





//MY ARRAY OF IMAGES that are currently on the stage
var thisNowArr:Array = new Array();
thisNowArr.push(cash);
thisNowArr.push(cash2);
thisNowArr.push(cash3);
trace(thisNowArr);



emitter.counter = new Blast( 150 );


var renderer:DisplayObjectRenderer = new DisplayObjectRenderer();
renderer.addEmitter( emitter );




//HERES SOME CODE I FOUND OUT THERE AND MODIFIED IT
var particles:Array = Particle2DUtils.createParticles2DFromDisplayObjects(thisNowArr,renderer,emitter.particleFactory);
emitter.addExistingParticles( particles, false );




emitter.addInitializer( new Position( new RectangleZone( 10, 10, 680, 480 ) ) );
emitter.addInitializer( new Velocity( new DiscZone( new Point( 0, 0 ), 150, 100 ) ) );
emitter.addAction( new ApproachNeighbours( 150, 100 ) );
emitter.addAction( new MatchVelocity( 20, 200 ) );
emitter.addAction( new MinimumDistance( 10, 600 ) );
emitter.addAction( new SpeedLimit( 100, true ) );
emitter.addAction( new RotateToDirection() );
emitter.addAction( new BoundingBox( 0, 0, 700, 500 ) );
emitter.addAction( new SpeedLimit( 200 ) );
emitter.addAction( new Move() );
addChild( renderer );
emitter.start( ); ]]>
particles composed of different elements http://flintparticles.org/forum/comments.php?DiscussionID=333&Focus=1157#Comment_1157 http://flintparticles.org/forum/comments.php?DiscussionID=333&Focus=1157#Comment_1157 Tue, 06 Apr 2010 10:42:11 +0100 Richard
As well as adding your three images, you're also using a Blast counter to add 150 further particles. It throws an error because you haven't defined what display object should be used for these other particles. If you don't want any more particles, don't define a counter on your emitter. ]]>