Flint Particle System Forum - Image explosion with symbol on stage 2010-12-25T19:13:47+00:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher Image explosion with symbol on stage http://flintparticles.org/forum/comments.php?DiscussionID=155&Focus=624#Comment_624 2009-01-14T23:32:59+00:00 2009-01-14T23:33:47+00:00 speasley http://flintparticles.org/forum/account.php?u=139 I'm banging my head against the wall over this. I have a symbol on stage that I want to explode, similar to the Explode Image example. My code breaks here: var particles = ...
var particles = Particle2DUtils.createParticle2DFromDisplayObject(sprite,renderer,emitter.particleFactory);
emitter.addInitializer(particles);

This results in:

TypeError: Error #1034: Type Coercion failed: cannot convert org.flintparticles.twoD.particles::Particle2D@37fc30e1 to org.flintparticles.common.initializers.Initializer.
at classes::Main/doExplosion()


I can't seem to figure out how to make use of createParticle2DFromDisplayObject.

Thanks for your help.]]>
Image explosion with symbol on stage http://flintparticles.org/forum/comments.php?DiscussionID=155&Focus=626#Comment_626 2009-01-15T08:03:45+00:00 2010-12-25T19:13:47+00:00 Richard http://flintparticles.org/forum/account.php?u=1 It your second line of code, you're trying to add the particle as an initializer - it's not an initializer, it's a particle. Try var particle = ...
var particle = Particle2DUtils.createParticle2DFromDisplayObject(sprite,renderer,emitter.particleFactory);
emitter.addExistingParticles( [particle] );


if you want to apply your emitter's initializers to the particle, change the second line of code to

emitter.addExistingParticles( [particle], true );]]>