share some thing

hi
i like box2d engine....but i am beginner so can any body post some source code were box2d is used..so that i can go thorugh it.

Thanks
Rahul
//////////////////////////////////
import Box2D.Collision.*; // bounding box of our world
import Box2D.Common.Math.*; // for vector(define gravity)
import Box2D.Dynamics.*; // define bodies and define world
import Box2D.Collision.Shapes.*; // define our shapes
import flash.display.*; // sprite class

var worldBox:b2AABB = new b2AABB();

worldBox.lowerBound.Set(-100,-100) // 1 meter = 30 pixels
worldBox.upperBound.Set(100,100);

// define gravity
var gravity:b2Vec2 = new b2Vec2(0, 10) // 300 pixels / s^2

var bSleep:Boolean = true;

var myWorld:b2World = new b2World(worldBox, gravity, bSleep);

// define our shape
var boxDef:b2PolygonDef = new b2PolygonDef();
boxDef.SetAsBox(3,1); // 1 meter = 30 pixels, width 90, height 30
boxDef.friction = 0.3 // between 0 and 1

// define our body
var bodyDef:b2BodyDef = new b2BodyDef();
bodyDef.userData = new Sprite();
bodyDef.userData.width = 90;
bodyDef.userData.height = 30;
bodyDef.position.Set(9, 10) // x = 165, y = 300

addChild(bodyDef.userData);

var body:b2Body = myWorld.CreateStaticBody(bodyDef);
body.CreateShape(boxDef);
body.SetMassFromShapes();

// debug draw
var dbgDraw:b2DebugDraw = new b2DebugDraw();
dbgDraw.m_sprite = new Sprite();
addChild(dbgDraw.m_sprite);
dbgDraw.m_drawScale = 30.0;
dbgDraw.m_fillAlpha = 0.3;
dbgDraw.m_lineThickness = 1.0;
dbgDraw.m_drawFlags = b2DebugDraw.e_shapeBit |b2DebugDraw.e_centerOfMassBit;

myWorld.SetDebugDraw(dbgDraw);

var m_timeStep:Number = 1.0 / 24.0;
var m_iterations:int = 10;

addEventListener(Event.ENTER_FRAME, Update, false, 0 , true);

function Update(e:Event):void{
myWorld.Step(m_timeStep, m_iterations);

}



//////////
now can u help me to control this object by mouse..aand if i throw this object it will have all that effect...
There's a fairly extensive testbed, with examples of pretty much every feature. Have you looked at that? If so, what's missing?

Bill

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