Using Textmate for Actionscript

I’ve never liked the default code editor that comes with the Flash IDE, so when the I discovered that I would need to develop actionscript code for a project, my first thought was to use Textmate instead. Incidentally, some people are already doing this.

I’ve used MTASC to compile Actionscript files before, the most important difference that surfaces when comparing it to Macromedia’s Actionscript compiler (MMC), which is the one that’s packaged in every installation of Flash, is that MTASC is much stricter on enforcing proper syntax. This is intended to reduce occurences of hard to find bugs that arise from improper scripting. The other feature that MTASC touts is its faster compile speed, however I’ve not experienced a visible variance between it and MMC. I would think that this speed improvement would be more apparent when compiling large projects consisting of more than 50 Actionscript files.

I’m using dirtystylus’ Textmate command for checking the syntax of my files, it took me a while to get it working as I organised the dependencies differently. Following my conventions in using MacPorts which is installed in /opt/local/, MTASC and XTrace were placed in /opt/local/managed/. The executable for MTASC was stored in /opt/local/managed/bin/ while was copied to the Applications folder. All supporting scripts were moved to /opt/local/managed/lib/.

This is the customised command that I’m using after trying for about 2 hours.

CLASSPATHS="-cp /opt/local/managed/lib/mtasc/std/ -cp /opt/local/managed/lib/mtasc/std8/ -cp /Users/douglas/Library/Application Support/Macromedia/Flash 8/en/Configuration/Classes/"
TRACE="-trace com.mab.util.debug.trace"
compileResult=`$MTASC -main "$SOURCE" -wimp -version $VERSION -strict $CLASSPATHS $TRACE 2>&1`
echo "

 body {margin: 10px; font-family: Monaco; font-size: 14px;} a {color: #000000; text-decoration: underline;} a:hover {color: #666666;}   function closeWin() { self.close(); } "
if test -n "$compileResult"
errorLine=`echo $compileResult | sed 's/.*:([0-9]*):.*/1/'`
echo "<a href="//$TM_FILEPATH&amp;line=$errorLine">$compileResult</a>";
echo "

3 thoughts on “Using Textmate for Actionscript

  1. Thanks for the heads up, Mark. I get bothered by the number of hoops we have to jump through just to be able to work more easily in an environment other than the Flash IDE though.

  2. Actually I found it easy to setup a Flex development projects in TextMate. Using Flex Builder 2 or Eclipse was way too slow on my system.

    Got the TextMate bundle from here:

    Taking the bundle above, I modified the [dirs] paths to my include own Flex SDK dir,:
    dirs = [


    And towards the end, modified the script to use Firefox instead of Safari:
    system(“open -a Firefox “#{outputFile}””)

    And yes, debugging from the Flash Player log file really saves a lot of time as well.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s