Fork me on GitHub
Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

    • CommentAuthorspeasley
    • CommentTimeJan 14th 2009 edited
     
    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 = 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.
    • CommentAuthorRichard
    • CommentTimeJan 15th 2009
     
    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 = 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 );