Moving on to a new toolset to compile flex and actionscript on mac without flex builder. Fiddled around with XCode for a while. Then I decided that the compile times were too slow using mxmlc alone, and started using fcsh in the Terminal or iTerm. But that meant losing the convenience of compiling from within XCode.
Soooo, there’s TextMate, also a fine editor for the Mac challenged. And Joachim Van der Hoeven has put together a TextMate Bundle to compile mxml and actionscript 3 using fcsh (or mxmlc if you choose).
Installing the bundle is no problem, he gives you a script you can use to update the bundle on his site:
http://www.4d.be/update-as3-and-flex-bundle-script
The necessary ingredients:
- flex 2 sdk
- TextMate (39 euros well spent)
- the as3 and flex bundle
- iTerm
- fcsh
Each of these can be installed relatively simply, in other words: if I can do it, anyone can.
Things didn’t go smoothly right off the bat though. Some tweaks, or setup completion was necessary, at least the way things are set up chez moi.
First there seemed to be a problem with iTerm, so I got the latest version and re-installed that. Then I had to set the path to the flex sdk in TextMate, since by default the script looks for Flex Builder, which I decidedly don’t have, errh, don’t want to pay for. I also had to set the path for the -output parameter for mxmlc, since it’s at a different location than the project source files.
Setting these variables in TextMate is straight forward, once you figure out that it’s necessary. I needed to set these:
- $TM_FLEX_FILE_SPECS (the file to be compiled, same as -file-specs when you use mxmlc on the command line)
- $TM_FLEX_OUTPUT (the swf you get back, same as -output param for mxmlc)
- $TM_FLEX_PATH (the path to where you installed the flex 2 sdk)
In TextMate, I set the $TM_FLEX_PATH under Preferences > Shell Variables, since that’ll be the same for all flex/actionscript projects. Then I set the $TM_FLEX_FILE_SPECS and $TM_OUTPUT at the project level, since that can change with each project, and since for the current project I need the swf in a different location than the source files (and probably for most projects, anyway).
That’s a little hidden. With nothing selected in the project drawer, click on the little i at the bottom. You’ll get a box to enter any variables you want for the project.
So far so good.
The one last thing to fix is getting the browser to open up at the location I need it to. With the default -output location (same as source files) the compile script was opening up Safari to display the newly compiled swf. That was nice. But it seems to have broken now that I’ve changed the -output location.
(
That’s for another time. For now I’ll make do switching to the browser and refreshing the page I need.
Many thanks to Christoph for his post that first put it all together for me. danke!


