Flint Particle System Forum - particles composed of different elements 2011-12-13T06:06:29+00:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher particles composed of different elements http://flintparticles.org/forum/comments.php?DiscussionID=333&Focus=1138#Comment_1138 2010-03-08T22:06:55+00:00 2011-12-13T06:06:29+00:00 akrobata79 http://flintparticles.org/forum/account.php?u=328 hi there 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 ...
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 2010-04-06T10:42:11+01:00 2010-04-06T10:43:31+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Hi 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 ...
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.]]>