Track press for your games with Promoter

The new way of setting up a AS3 project in TextMate

by Andreas Zecher

More then two years ago I wrote a guide on how to use TextMate for developing ActionScript 3.0 projects using the free Adobe Flex SDK. It is the most popular blog post on my site until today. As with many other step-by-step tutorials, it has become outdated though. The good news is that it has become much easier to setup TextMate for AS3. Here’s the new way of doing it:

1. If you don’t already own it, download and install the trial version of TextMate from the Macromates website. If you are new to TextMate have 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 Open Source website. The latest stable and tested version at the time of writing is Flex SDK 4 Release. Move the extracted folder into your Developer/SDKs folder. If those two folders don’t exist yet, create them at the root of your harddrive.

3. Download Simon Gregory’s ActionScript 3 bundle for TextMate from GitHub. Unzip the downloaded file. Rename the folder to ActionScript 3.tmbundle and double-click it. TextMate will install the bundle and add it to the Bundle Menu.

4. 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 somewhere in the Project Drawer so that the new folder is not selected. Then 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		bin/Main.swf

5. For compilation we want to use the faster Flex Compiler Shell (fcsh) instead of the default mxmlc compiler. To enable it go to TextMate→Preferences→Advanced→Shell Variables and add a new global variable:


6. Let’s write a simple “Hello World” application. Create two new folders named bin 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.";

7. Make sure that ActionScript 3 is selected in the language dropdown menu and then save your project from the file menu. Press Apple+B to compile the main class. This will open the terminal and start up the Flex Compiler Shell. You will find the generated Main.swf in the bin folder.

8. Open the Main.swf with the Flash Player. If you have not installed it yet, you can find it in your Flex SDK installation under runtimes/player/10/mac/Flash