Compiling the Flex 4.5 SDK in Eclipse for the brave & patient

Unwilling to shell out ~$600 for Flash Builder 4 Premium or upgrade from my older Flex 3 IDE, my Actionscript development halted a couple of years ago. Not wanting to give up completely on Adobe webdev, I gave the open-source Flex SDK a shot and configured my Eclipse environment for good-old Flash. The result wasn't as painless as I'd thought.

First download the Flash uninstaller (Mac, Windows) and . Might want to bookmark or save this blog URL since the Flash loader will make you force-quit all internet browsers.

After giving Flash the boot, grab the latest Flex SDK from Adobe's developer site. The SDK includes the compiler we need in our build setup - sdkroot/bin/mxmlc - so extract the SDK somewhere you'll remember. It also includes an installer for the latest debug version of Flash inside sdkroot/runtimes/player/xx.x/your_os  

Setting up a Flex SDK project in Eclipse involves creating a builder and passing in custom arguments. The builder simply compiles the application using lib & SDK references and saves it to a SWF file in the bin folder. The arguments look like src/application.mxml -output=bin/application.swf -library-path+=libs/ -target-player=xx.x with the 'xx.x' replaced by the minimum version of Flash required by the SDK you are using. Min versions by SDK are:

Flex 4.0 SDK - Flash 10.0 minimum Flex 4.5 SDK - Flash 10.2 minimum Flex 4.6 SDK - Flash 11.1 minimum

I won't go through the Eclipse project setup here as other blogs cover this pretty in-depth. See these for coverage: barebones walkthrough with screenshots detailed walkthrough

Scouring Google will lead to some pitfalls searching for up-to-date MXML & AS3 editor plugins for your non-Flash-Builder IDE. To save you the trouble, FlexFormatter is the best plugin I've found and lets you customize the format handling of both MXML & AS3.

FlexFormatter links: Google Code SourceForge Update Site

Other widely used, open-source plugins are xsd4mxml and Axdt. I'm not sure though if these plugin projects are still being maintained.

xsd4mxml links: Google Code

Axdt links: Eclipse Marketplace GitHub Update Site

FDT links: Eclipse Marketplace Update Site

While you're at it you'll want to gitclone and import as3corelib - a practical swiss-army knife of actionscript classes and utilities.

On the subject, if you're up for trying a new actionscript development architecture I've been very impressed by Swiz Framework. Swiz uses Inversion of Control through instantiating a BeanProvider class which initially registers controllers, delegates, services, models, and presentation-models (declared as prototypes). These can be flexibly injected with bindings throughout the app. It even supports reverse and two-way (bijection?) bindings.