Closed qgewfg closed 10 years ago
Hi Justin, first of all: sorry for the late reply! You reached me in a busy time. ;-)
Actually, I don't think it's a good idea to make it like this. The problem is that in many situations, people are re-using their particle systems. E.g. you create an explosion PS and keep it on the screen, simply restarting it when an explosion happens. Somebody who uses this approach doesn't want to have the PS be removed from the juggler all the time.
I know I'm doing this with Tweens, but they are a little different: they are small, lightweight objects, not supposed to be reused. You create a tween only once and then forget about it.
So, in your case, you should simply listen to the COMPLETE event and manually remove it from the juggler when it's called.
I hope you're okay with that and I could explain my reasoning well enough! :-)
change the event that will be dispatched when emission of particles is finished from "COMPLETE" to "REMOVE_FROM_JUGGLER".
if someone wrote
Starling.juggler.add(mParticleSystem);
but didn't remove manually like thisStarling.juggler.remove(mParticleSystem);
that will cause memory leak.and other objects that can be added to juggler are not require remove manually.