Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
-
- CommentAuthorakrobata79
- CommentTimeMar 8th 2010
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 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( ); -
- CommentAuthorRichard
- CommentTimeApr 6th 2010 edited
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 other particles. If you don't want any more particles, don't define a counter on your emitter.
1 to 2 of 2
