Learning by example is always the best way to understand a new tool. So with the FlasCC SDK we ship a number of fully working examples of open source libraries being compiled and used within SWFs. By reading the documentation and investigating these examples you should be able to get a good understanding of how best to use FlasCC.
These projects can be found in the /samples/ folder of the FlasCC SDK which can be downloaded from the Adobe Gaming Tools page.
The Box2D example creates a SWC from the C++ Box2D library. SWIG is used to automate the process of generating all of the wrapper code which is incredibly helpful as it avoids you writing lots of tedious and bug-prone wrapper code by hand. Having the ActionScript API auto-generated like this can be an important timesaver if you need to update the underlying C++ code.
Bullet is a large C++ library with roughly 130 thousand lines of code. It is used throughout the industry for both offline and real-time physics simulations. It not only supports basic rigid-body physics, but also more advanced soft-body physics for simulating deformable objects such as cloth. Creating a SWC with an ActionScript API for Bullet is a trivial process and allows ActionScript developers high-performance access to this great library. The demo we ship with the FlasCC SDK shows how to create a simple 3D scene using the Away3D library and how Bullet can be used to provide physical simulation for the objects in the Away3D scenegraph.
Live Demo: http://www.cmodule.org/Away3DBulletPhysics/
Due to its small size and how easy it is to embed within other environments a lot of people are choosing Lua as their scripting language of choice. The reference implementation of the Lua interpreter is written in C and is designed to be compiled as a library and linked into other projects. As with the other examples we used SWIG here to automatically generate the AS3 bindings. We also write some interop code by hand that reflects the AS3 API into Lua so that Lua programs can be run within the Flash Player and can interoperate with the Flash API set. We wrote a simple real-world example that shows a Starling-based AS3 application that is controlled by a Lua script that can be updated while the SWF is executing.
Live Demo: http://www.cmodule.org/lua/
Click “Run Script” to execute the Lua script. Note that you can edit the script live and click “Run Script” again to execute your latest changes. For example try changing the line “gravity = 5″ to “gravity = 0.01″ and click Run Script again to see your changes.
This was the killer demo for the original Alchemy prototype and showed that complex C code could be compiled correctly into a SWF with excellent runtime performance. The game might be old, but it still looks surprisingly good and performs better when compiled with FlasCC than it did with the old Alchemy prototype.
For a more modern killer demo take a look at the FlasCC-compiled Unreal Engine live demo.