Destroying box2d(Box2D Flash) objects is always not smooth, if you don’t manage the references properly. Well sometimes it doesn’t get destroyed also even after calling DestroyBody() method because there is still some reference to box2d objects that is active and u have to keep track of that. I had this problem more often. But yeah i again came up with my just stupid solution to tackle above problem and it works. I have tested this in my all Box2D Flash projects.

What i generally do is create a custom class which would represent particular box2d body, for example in pool game i would create a class called Ball. So now i would create a method called getDestructionStatus() which tells me if particular body is eligible for destruction. And second method i would define called destroy(), in destroy() method you can write your cleanup() implementation like if u have some movieclip associated then you can remove it from stage [Note: I didn’t call DestroyBody in destroy() because it didn’t work for me] Something like this :

public function destroy():void {
	//your custom cleanup code before making box2d body eligible for destruction
			
	destructionStatus = true;	//eligible for destruction	
}
public function getDestructionStatus():Boolean {
	return destructionStatus;
}

Now how would u implement ? Well lets say if my ball collides with wall then i want to destroy the ball, so code would look like this:

override public function BeginContact(contact:b2Contact):void 
{
	if ((contact.GetFixtureA().GetBody().GetUserData() is Wall && contact.GetFixtureB().GetBody().GetUserData() is Ball)) {
		contact.GetFixtureB().GetBody().SetAwake(false);
		contact.GetFixtureB().GetBody().GetUserData().destroy();
	}
}

Above i am using a custom class that extends b2ContactListener class and i am overriding BeginContact to determine the collision and provide my some custom implementation response. Here is a insight on b2ContactListener tutorial from Allan Bishop.

Now when my ball collides with wall then i call destroy method on it, which runs my custom cleanup and set the destructionState to true. Now i will check for this destructionState and call DestroyMethod, calling DestroyBody in correct context and block matters because as i said if some reference is still pointing to body then it won’t get detroyed. Here is the implementation code:

for (var worldBody:b2Body = world.GetBodyList(); worldBody; worldBody = worldBody.GetNext()) {
	if (worldBody.GetUserData() != null) {
                if (worldBody.GetUserData().getDestructionStatus()) {
			world.DestroyBody(worldBody);
		}

                //write a code to update the position, rotation whatever you want of bodies
        }
}

Now comes the main part:
I want to explicitly point out that i have put DestroyBody call inside the world body list iteration because it always worked for me without any issues, my bodies got destroyed and that was what i wanted. I hope it works for you also. I also want to try other techniques, so if you apply other way to destroy objects then please share with us. It would help me and others a lot xD

Gracias