Track press for your games with Promoter

Setting up a AS3 Project in Textmate

by Andreas Zecher

This guide is outdated
Please read the new guide on how to setup TextMate for AS3 projects instead.

When developing Flash games I use a fairly uncommon combination of development tools which I’d like to share here. I’ll give an overview on how to setup the OS X editor TextMate for developing ActionScript 3.0 projects using the free Adobe Flex SDK. If you are new to Flash development and working on a Mac this might be a good alternative to buying Flash Professional 9 or Flex Builder since TextMate is available for a convenient price of €39. Setting everything up can be a little bit tricky and requires a number of steps so I try to be as clear as possible. Let’s go …

1. Download and install the 30 Day Trial of TextMate from the Macromates website. If you are new to TextMate please take a look at the online manual to familiarize yourself with the basic functions of the editor.

2. Download the free Flex SDK from the Adobe website. Move the extracted folder into your Developer/SDKs folder.

3. Make sure that you have Subversion installed. If you don’t you can download an easy-to-install package of Subversion from the homepage of Martin Ott.

4. Get the latest ActionScript 3 bundle for TextMate using Subversion. To do this, open the Terminal application, copy the following script into the Terminal and execute it by pressing return.

mkdir -p /Library/Application\ Support/TextMate/Bundles
cd /Library/Application\ Support/TextMate/Bundles
export LC_CTYPE=en_US.UTF-8
svn co
osascript -e 'tell app "TextMate" to reload bundles'

Now the ActionScript 3 Bundle should show up in the TextMate Bundle menu.

5. Download and install the Flex Compiler Shell — it compiles much faster than the standard mxmlc compiler by keeping everything in memory.

6. To use the Flex Compiler Shell from TextMate we also need to download and install the terminal application iTerm.

7. Now let’s set up a new ActionScript project in TextMate. Select File→New Project from the menu, create a new folder for your project in the Finder and drag it in the TextMate Project Drawer. Click on the info button located in the bottom of the Project Drawer. Add two shell variables so that the ActionScript Bundle knows where to look for your files:

TM_FLEX_OUTPUT		deploy/Main.swf

We also need to let TextMate know where the Flex SDK is located. Go to TextMate→Preferences→Advanced→Shell Variables and add a new global variable:

TM_FLEX_PATH	Developer/SDKs/Your Flex SDK Folder

8. You are still with me? Great. Let’s finally write a simple “Hello World” application. Create two new folders named deploy and src in your project directory. Then create a new file in the src folder and name it It should look something like this:

	import flash.display.Sprite;
	import flash.text.TextField;

	[SWF( backgroundColor='0xFFFFFF', frameRate='30', width='200', height='200')]

	public class Main extends Sprite
		private var textField: TextField;

		public function Main()
			textField = new TextField();
			textField.text = "Hello World.";

10. We are almost done! Make sure that ActionScript 3 is selected in the language dropdown menu. Press Shift+Command+B and select Build (fcsh) to compile the main class. This will open iTerm and start up the Flex Compiler Shell. You will find the generated Main.swf in the deploy folder. That’s it.