Fork me on GitHub
Not signed in (Sign In)
    • CommentAuthorBrokenBulb
    • CommentTimeJun 20th 2010
     
    I'm using EmitterEvent.COUNTER_COMPLETE to track the end of emission of a short particle effect, but it doesn't seem to fire every time.

    code in cs5:


    particleRenderer = addChild(new DisplayObjectRenderer());
    particleRenderer.x = circImg.x - circImg.width / 2;
    particleRenderer.y = circImg.y - circImg.height / 2;
    var emitter:Emitter2D = new Emitter2D();
    particleRenderer.addEmitter(emitter);
    emitter.counter = new TimePeriod(300, 2);
    emitter.addInitializer(new ImageClasses([[RadialDot, 5, 0x0000ff],[RadialDot, 4, 0x0000ff],[RadialDot, 3, 0x0000ff],[RadialDot, 2, 0x0000ff]]));
    emitter.addInitializer(new Position(new BitmapDataZone(new MagicCircleImg(1, 1))));
    emitter.addInitializer(new Velocity(new LineZone(new Point(0, -100), new Point(0, -150))));
    emitter.addInitializer(new Lifetime(1, 2));
    emitter.addAction(new Age(Linear.easeIn));
    emitter.addAction(new Fade(1, 0));
    emitter.addAction(new Move());
    emitter.addEventListener(EmitterEvent.COUNTER_COMPLETE, removeEffect);
    emitter.start();
    • CommentAuthorRichard
    • CommentTimeJun 20th 2010
     
    Hi

    I tested your code in Flash CS4. I ran it thirty times and the COUNTER_COMPLETE event fired every time. Are you certain the error isn't in your event handler? I put a trace in the removeEffect method to confirm that it was running each time.
    • CommentAuthorBrokenBulb
    • CommentTimeJun 20th 2010
     
    Hi Richard, thanks for replying.

    Yeah, i'm not sure what's going on. I also used a trace in the handler and it traces almost every time. but every once in a while it fails. Sometimes it failed withing the first few runs, sometimes I had to run it many times, but it always fails at some point.

    I'm not sure how to help you reproduce it other than to say keep trying :) sorry.
    • CommentAuthorRichard
    • CommentTimeJun 21st 2010
     
    I found the problem and have checked the fix into SVN.