APE, or the Actionscript Physics Engine is a free as3 physics engine built by Alex Cove. It is really easy to use once you get the hang of it and it has detailed documentation to read if you get stuck.
In this tutorial i will show you how to make a simple ball example with gravity.
Firstly you will need to download the latest version of APE. There is a stable release on Alex Cove’s website but i am using the ‘bleeding edge’ one from the google code repository. You can download the whole package from my site here.
Unzip the folder and save it in a place so that you know where it is for example mine is located in my documents folder on my computer.
Now load up flash and create a new actionscript 3 file like normal and save this file however you want. To load the APE classes into the flash authoring environment so that we can use them we first need to change the root classpath of the .swf that will be created. The next step is the most important to get APE running in flash. Follow exactly as i say!

Go to file>publish settings then a screen should pop up that looks like this one below. Click on the flash tab in the centre, that is highlighted in the picture below. Now look to the picture on the right.

Click on actionscript 3 settings, where the mouse curser is on the screenshot. A screen like the one below should show.

Click on the browse to path button that is above the large ‘classpath’ box at the bottom of the window, where the mouse curser is pointing.

This will send you to a browsing screen where you have to select the classpath.
h of your .swf. You need to choose the ape_a045 folder that you downloaded earlier and select the source folder inside that. This is where your classpath needs to be. Take a look at this picture. The folder should only have a folder called org inside it like shown.
Click choose and then the white box at the bottom of the publish settings should have the direct path to the source folder inside the ape_a045 folder on it.
If the class path is correct click OK and then click OK again to return to the flash authoring environment.
Next we can start to code and use the engine.



August 30th, 2008 at 9:46 am
Thanks tudway!
August 30th, 2008 at 9:53 am
just noticed something this is for macs only
August 30th, 2008 at 10:02 am
Nope, it is for windows as well and is essential to get the APE library working in CS3. I know it looks different but try and follow the steps exactly as i have said. Most of the screenshots look almost exactly the same in the windows version of flash.
August 30th, 2008 at 10:44 am
Try following the tutorial now, i had missed out a step where you have to choose the flash tab at the top of the publish settings page. Hope it now works.
September 14th, 2008 at 3:56 pm
[...] APE Tutorial – getting started [...]
October 24th, 2008 at 11:45 pm
[...] start off open a Flash CS3 document and set up the file like i showed you for the last tutorial, here. The ActionScript is as follows: PLAIN TEXT [...]
April 2nd, 2009 at 8:17 pm
[...] -APE : Getting Started Tutorial [...]