Removing "this" Class from Display List

Hellos. Just wondering if anyone can help with a small problem I’ve been having…

I’m making an AS3 app that spawns a bunch of particles. Each particle uses a Particle class that extends Sprite. The particle is then added to the display list.

Inside Particle.as, I have code to handle all of the movement and stuff. I want the particle to delete itself when it goes outside the screen. Right now, I have something like this:

if(x>550 || x<0 || y>400 || y<0){
parent.removeChild(this);
}

Unfortuently, that doesn’t work - and seems to just crash Flash majority of the time.

So yeah…how do I delete the particles - from within Particle.as? :slight_smile: