Here's how it's used:
1. Drop the attached file, "Shape For Box2d.jsfl", into one of the following folders:
Windows Vista - boot drive\Users\username\Local Settings\Application Data\Adobe\Flash CS3\language\Configuration\
Windows XP - boot drive\Documents and Settings\username\Local Settings\Application Data\Adobe\Flash CS3\language\Configuration\
Mac OS X - Macintosh HD/Users/username/Library/Application Support/Adobe/Flash CS3/language/Configuration/
2. Draw a shape in Flash, preferably with a tool that creates straight lines, like the Pen Tool.
4. Select the whole shape (triple click it).
5. Go to the "Commands" menu. You should see the new option "Shape For Box 2d". Click it!
The computed polygons will appear as red lines over your original image. Additionally, a structured array will be spit out into the output panel. The array is structured like so:
Array of polygons > Array of vertices > x, y
You should be able to parse this pretty easily within your own code to create the Box2D shapes.
I apologize for the code in the .jsfl file being messy as hell. I just wanted to get something that works. I basically just ported the code from these two resources (comments and all):http://www.ewjordan.com/earClip/http://livedocs.adobe.com/flash/9.0/mai ... l#wp461362
The red outlines don't go away until you run the command again.
Haven't tested on a PC
Doesn't process "holes"