Adding a movie clip to Ragdoll

I'm trying to 'skin' the ragdoll in the testbed and am having some difficulties. I'm sure it's something really easy but i can't figure it out. I've created the movieclip with linkage as headImage, but it gives an error for addChild(bd.userData) ??

Code:
//head         
circ.radius = 12.5 / m_physScale;
circ.density = 1.0;
circ.friction = 0.4;
circ.restitution = 0.3;
bd = new b2BodyDef();
bd.AddShape(circ);
bd.userData = new headImage();
bd.userData.width = circ.radius * 2;
bd.userData.height = circ.radius * 2;
bd.position.Set(startX / m_physScale, startY / m_physScale);
addChild(bd.userData);
var head:b2Body = m_world.CreateBody(bd);
This is a bit of a hack, but you can edit the testbed code like so:

Do as you did before, editing the ragdoll code with "bd.userData = new headImage();" etc.

Instead of:
Code:
addChild(bd.userData);


Use:
Code:
Main.m_sprite = bd.userData;


Then, to the first line of the "update" function in Main.as, add:
Code:
addChild(m_sprite);


Then, to the "Update" function in Test.as, add:

Code:
for (var bb:b2Body = m_world.m_bodyList; bb; bb = bb.m_next){
            if (bb.m_userData is Sprite){
               bb.m_userData.x = bb.m_position.x;
               bb.m_userData.y = bb.m_position.y;
               bb.m_userData.rotation = bb.m_rotation * (180/Math.PI);
            }
         }


This will draw and update the user sprite, but will do bad things to the testbed vector drawing routines ( probably trivial to solve properly, but I haven't done so yet). I just knocked out the DrawJoint(); and DrawShape(); loops from Test.as to stop them strobing.
oh, you can just generate a separate sprite in main for the userData and update that in parallel with the vector drawing sprite to run both at once.
Thanks, I didn't realize there was so much linking back to Test.as and Main.as. I took your advise and basically remade the ragdoll in a new world and disregarded the DrawJoint(); and DrawShape(); loops and i now have a functional 'skinned' ragdoll that oddly resembles the South Park version of Sadam lol.
Thanks again!

-Bryan

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