0

When I sue the following code the body graphic is removed, however in debug mode I can still see the outline of the body which would suggest the body still exists. How do I totally remove this body?

private function updateGraphics(b:Body) {
            if (b.position.y > 360) {
play.removeChild(b.userData.graphic);

}

}
LeBlaireau
  • 17,133
  • 33
  • 112
  • 192

1 Answers1

2

Nape has nothing to do with graphics. A Body is not magically tied to the way you display it on the screen, so removing a flash displayObject from a display list cannot possibly remove the nape body from the space.

The answer, is to remove it from the nape space!

body.space = null;

is the simplest way.

deltaluca
  • 1,652
  • 2
  • 10
  • 9