Tuesday, November 9, 2010

Flex Formatter is your friend.

Today I am helping a co-worker get setup to start using the FLEX project I've built over the past 3 months. My co-worker is well versed in ActionScript and has heaps of experience with it.

After loading the project (insert funny analogy here), the first thing my coworker suggested to me was to use the open-source & free: Flex Formatter:
http://sourceforge.net/projects/flexformatter/

Flex Formatter is somewhat like Resharper, for Visual Studio. It definitely is not as cool as Resharper, but it's free and it has re-formatted my ActionScript code, fairly easily.

To use Flex Formatter plugin, for Flashbuilder 4, you need to download it (obviously) and then extract the 3 .JAR files into your Flashbuilder 4 plugin directory.

My FB4 plugin directory was located here:
C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\plugins

After the plugins are in place, you must restart Flash Builder 4 to see the new "Preferences" window for it. You also get some toolbar buttons in the FB4 IDE, where you can reformat code from there. Here is what the preferences window should look like:





You can also import "rules" files, to enforce specific syntax formatting rules. Currently I only have the ActionScript rules setup. We did not provide rules for MXML (yet), but I was able to format my MXML by using the toolbar buttons in the IDE.

This will create a normalized syntax style for the 1000s of lines of code I have produced. Very cool.

No comments: