Flint Particle System Forum - Get the x/y of last particle when it dies?2010-12-25T17:21:40+00:00http://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_8722009-07-24T16:41:20+01:002010-12-25T17:21:40+00:00TackleMcCleanhttp://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_8902009-08-08T11:08:25+01:002010-12-25T17:21:40+00:00Richardhttp://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_9482009-11-02T03:54:52+00:002010-12-25T17:21:40+00:00gordeaouxhttp://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_9492009-11-02T04:59:20+00:002010-12-25T17:21:40+00:00gordeaouxhttp://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_9532009-11-02T08:45:43+00:002009-11-02T08:45:58+00:00Richardhttp://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) }]]>