The Body is simply a "Body" variable, it contains all your shapes.
All your shapes in a body remain the same distance and rotation from each other (i think)
You wrote your boxDef not your bodydef.
thats why you get the error in this line:
Code:
myWorld.CreateDynamic[b]Body[/b]([b]box[/b]Def);///////////////////////newline, returning compile errors
Physbox is a custom class that is in the .fla file which just contains a picture.
This is set as the UserData because thats how the engine handles custom content?
Also I think some of your code is jumbled thats why you're getting the silly errors.
Heres what I do when creating objects:
Create my Body, in this case i'm using protag as my body.
Create a body defination.
Create a Shape Defination.
Apply Body defination to Body.
Add shape defination to Body.
Code:
var protag:b2Body; //my body, the name you call it by later
var protagBD:b2BodyDef = new b2BodyDef; //my body's defination
protagBD.position.Set(275/30, 200/30);//setting the position of the body
var protagSD:b2PolygonDef = new b2PolygonDef;//my Shape Defination
protagSD.SetAsBox(20/30, 20/30);//setting my shape as a box and defining HALF it's height and width.
protagSD.density = 0.5;//Setting the density
protagSD.restitution = 0.3;//settign restitution or bouncyness
protag = m_world.CreateDynamicBody(protagBD);//applying my body Defination to my body
protag.CreateShape(protagSD);//creating my shape into my body
protag.SetMassFromShapes;//setting the mass from my shape
Important things to note, size and position of your bodies and shapes is NOT in pixels, it's 30 times the number you put in since Box2d works in meters and the scale is 30px to 1 meter.
Also if you're using version 2.00 like me you should download the C++ version and use the manual from there.