Hello Box2D World

Box2D is free and open source, so you won't need to install components or deal with SWC files. All you need to do to include it in your projects is to include the required classes.

Open Main.as and write the following code snippet:

package  {
  import flash.display.Sprite
  import Box2D.Dynamics.*;
  import Box2D.Collision.*;
  import Box2D.Collision.Shapes.*;
  import Box2D.Common.Math.*;
  public class Main extends Sprite {
    public function Main() {
      trace("my awesome game starts here");
    }
  }
}

Test the movie and you should see my awesome game starts here in your Output window. This means you have successfully imported the required classes.

There isn't that much to say about the code we just wrote, as we are just importing the classes needed to ...

Get Box2D for Flash Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.