Flint Particle System Forum - Get the x/y of last particle when it dies? 2010-12-25T17:21:40+00:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher Get the x/y of last particle when it dies? http://flintparticles.org/forum/comments.php?DiscussionID=243&Focus=872#Comment_872 2009-07-24T16:41:20+01:00 2010-12-25T17:21:40+00:00 TackleMcClean http://flintparticles.org/forum/account.php?u=162 I have a single particle travelling across the screen. It dies within 1 second. My emitter listens for the ParticleEvent.PARTICLE_DEAD event. From what I've gathered, the event is dispatched and ... My emitter listens for the ParticleEvent.PARTICLE_DEAD event.
From what I've gathered, the event is dispatched and first AFTER the event has been handled, the particle is removed.

However, in my event handler for the event, I try this:
trace(e.particle.image.x);
trace(e.particle.image.y);

Both return 0.

trace(e.particle.isDead);
returns true as well

So the particle is removed before the event is handled, or at least before the code in the event handler runs.

How would one go about to try and figure out the x/y after a particle dies?]]>
Get the x/y of last particle when it dies? http://flintparticles.org/forum/comments.php?DiscussionID=243&Focus=890#Comment_890 2009-08-08T11:08:25+01:00 2010-12-25T17:21:40+00:00 Richard http://flintparticles.org/forum/account.php?u=1 When a particle dies, the emitter dispatches a particleDead event which caries information about the particle, including its location. particleDead event which caries information about the particle, including its location.]]> Get the x/y of last particle when it dies? http://flintparticles.org/forum/comments.php?DiscussionID=243&Focus=948#Comment_948 2009-11-02T03:54:52+00:00 2010-12-25T17:21:40+00:00 gordeaoux http://flintparticles.org/forum/account.php?u=262 I'm having the same problem as TackleMcClean, I get 0 in the output: emitter.addEventListener(ParticleEvent.PARTICLE_DEAD, pDead); function ... emitter.addEventListener(ParticleEvent.PARTICLE_DEAD, pDead);
function pDead(ef:ParticleEvent):void{
trace(ef.target.x)
}

I assume it's because the "target" refers to the Emitter2d object and not the particle. How do I figure out which particle has just died, or it's properties? Is particleDead different than ParticleEvent.PARTICLE_DEAD?]]>
Get the x/y of last particle when it dies? http://flintparticles.org/forum/comments.php?DiscussionID=243&Focus=949#Comment_949 2009-11-02T04:59:20+00:00 2010-12-25T17:21:40+00:00 gordeaoux http://flintparticles.org/forum/account.php?u=262 Never mind, fixed it. I thought I had tried this before, but it works now: function ...
function pDead(ef:ParticleEvent):void{
trace(ef.particle.image.x)
}

emitter.addEventListener(ParticleEvent.PARTICLE_DEAD, pDead);
]]>
Get the x/y of last particle when it dies? http://flintparticles.org/forum/comments.php?DiscussionID=243&Focus=953#Comment_953 2009-11-02T08:45:43+00:00 2009-11-02T08:45:58+00:00 Richard http://flintparticles.org/forum/account.php?u=1 This should also work function pDead(ef:ParticleEvent):void{ trace(ef.particle.x) }
function pDead(ef:ParticleEvent):void{
trace(ef.particle.x)
}
]]>