Removing bodies ect

Firstly please excuse my newbieness.

I have been playing around with Box2D for a little while now and it is slowly starting to make sense. Just wondering if someone could give me a nudge in the right direction with this.

I am just trying to remove a body which has a graphic attached to it via bodyDef.userData

I am trying to achieve this when the body is clicked upon using a GetBodyAtMouse function.

Here is what I have so far:


Code:
public function on_mouse_down(evt:MouseEvent):void {
var body:b2Body = GetBodyAtMouse();
m_world.DestroyBody(body);
body = null;
}



Which appears to remove the body but does not remove the attached graphic.

What am I missing? Some kind of removeChild call to remove it from the display list? If so, how do I reference the attached graphic?

I have read the manual but this is a pretty steep learning curve for me and not all of it makes to me sense just yet.

Any help greatly appreciated!

thanks
I would think that you had to call addChild in order to see that object in the first place, so yes, you'll need to first do something like this:

Code:
var displayObject:DisplayObject = b.GetUserData() as DisplayObject;
if(displayObject && displayObject.parent) displayObject.parent.removeChild(displayObject);

Original thread: https://box2d.org/forum/viewtopic.php?t=4808