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

    • CommentAuthorTuskony
    • CommentTimeJan 3rd 2011 edited
     
    Hey,

    I just downloaded the libraries for this particle system and I must say the examples I have seen are REALLY impressive!!!!

    What I am trying to do is explode a symbol that gets added to the stage dynamically.

    I have "batteries" drop out of the sky on to the stage and if the user doesn't click on them fast enough I want them to explode. I managed to make this work if I used a jpeg but I want to use symbols so it jives with the rest of my code.

    Here is what I have so far: (sorry it's probably butchered!)

    //Rendering stuff for exploding decayed batteries
    var emitter:Emitter2D = new Emitter2D();
    var renderer:DisplayObjectRenderer = new DisplayObjectRenderer();
    var particles = Particle2DUtils.createParticle2DFromDisplayObject(this, renderer, emitter.particleFactory);
    emitter.addExistingParticles( particles, true );

    renderer.addEmitter( emitter );
    addChild( renderer );
    emitter.start();

    This code is embedded in a method for the battery class that gets called when a timer event triggers telling the code that the battery has now decayed!

    It gives me the follow error when the timer event is triggered:

    "TypeError: Error #1034: Type Coercion failed: cannot convert org.flintparticles.twoD.particles::Particle2D@268e9031 to Array.
    at Battery_mc/BatteryDecayed()
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()"

    Any help would be greatly appreciated!
    • CommentAuthorven
    • CommentTimeJan 4th 2011
     
    Check out my code in Show and Tell category, might help you. Also, one thing I find helpful when developing (if in CS3/CS4) is to Permit debugging so line #'s of where the offending error/warning are shown; Publish Settings | Flash | Advanced

    -ven