A while back I created a few demos showing how to combine ActionScript physics engines (as well as 3d engines) with Halo components to create a physics-enabled UI. I wanted to see what could be done using the new Flex 4 Spark components and I was very surprised to find that almost nothing had been posted about using physics engines with Flex 4.
So I decided to put something together myself. Nothing ground-breaking here, but this demo uses the Box2D 2.0 physics engine and combines it with Spark buttons using some ideas I’ve taken from Eugene Karataev (translated) and his demo using Flex 3 called FallenUI.
This demo shows some Spark buttons that become physics-enabled once you click the ‘Start Simulation’ button. You can also drag them around and toss them into each other. I’m sure there is a better way to integrate Flex 4 and Box2D, but this is just a quick and dirty attempt to see if I could get it working with no Halo components involved. Of course, the source is also available from the context menu. Let me know what you think.View Source