Trouble setting 'active' value of dynamically created body

I'm attempting to change the 'active' setting of a dynamically created BodyShape upon a beginContactEvent involving one of its peers within the same MovieClip.

(I only mention that it's dynamically created because I've had no trouble changing attributes on BodyShapes that are not.)

I'm detecting contact between object1 & object 2 successfully, but I've been unable to find the right syntax for setting object3's 'active' value.

Here's one of many failed attempts:

Code:
      private function handleContact(e:ContactEvent):void
      {
         if (e.other.m_userData.name == "object1" && e.fixture.m_userData.name == "object2")
         {
            var theMutualParent = MovieClip(MovieClip(e.fixture.m_userData).parent);
            LineArc90(theMutualParent.object3).active = true;
         }
      }


When contact occurs I get the following error: "Assertion failed: (m_world->IsLocked() == false), function SetActive, file ../Box2D/Dynamics/b2Body.cpp, line 426."

I appreciate any insight! Thanks!
Box2D doesn't like you to do certain things while inside the timestep. Try this instead:

Code:
world.doOutsideTimeStep(function() {
    (e.relatedObject as DisplayObject).parent as BodyShape).active = true;
});
Perfect! 'doOutsideTimeStep' is just what I needed! Here's what I ended up doing (for anyone who might need this in the future):

Code:

private function handleContact(e:ContactEvent):void
{
   if (e.other.m_userData.name == "object1" && e.fixture.m_userData.name == "object2")
   {
      var theMutualParent = (e.fixture.m_userData as DisplayObject).parent;
      world.doOutsideTimeStep( function() {
         (theMutualParent.getChildByName('object3') as BodyShape).active = true;
      });
   }
}



Thank you for your help!

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