How to detect that an object moved off the screen

Is there some sort of event that is fired, as soon as an object moved off the screen? Or do I have to poll the coordinates each frame manually via the enterFrame event?

No, there isn’t. Yes, you need to do that checking yourself.

It’s a pretty simple check to do and unless you have some particular situation to account for, you probably can get away with just a timer which fires maybe once a second to perform that check.

The situation to account for would be if you really need things remove the moment they’re off screen, such as the risk that they might bounce back onto the screen - assuming that cannot be allowed.

You could also use a ‘collision hack’.

Create a sensor object covering the entire bounds of the screen, hide it, and then add bodies to your moving objects.  When collision “ended” occurs between the bounding object and your moving object, you’ve moved off screen.

I find that rather elegant. Thanks, roaminggamer!

No, there isn’t. Yes, you need to do that checking yourself.

It’s a pretty simple check to do and unless you have some particular situation to account for, you probably can get away with just a timer which fires maybe once a second to perform that check.

The situation to account for would be if you really need things remove the moment they’re off screen, such as the risk that they might bounce back onto the screen - assuming that cannot be allowed.

You could also use a ‘collision hack’.

Create a sensor object covering the entire bounds of the screen, hide it, and then add bodies to your moving objects.  When collision “ended” occurs between the bounding object and your moving object, you’ve moved off screen.

I find that rather elegant. Thanks, roaminggamer!