I am quickly becoming a big fan of jEdit, a Java-based editor I’d repeatedly (and perhaps unfairly) dismissed in the past. The fact is, there is a huge shortage of good ActionScript editors available for my chosen platform (OS X), and the more I use the popular commercial options, the more I realize I don’t want to work “Mac-like;” I want to work the same way I work when I’m not using my own computer at home. With a little work, and a whole lot of customizing (through macros, plugins and other magic), I really think jEdit can meet my needs on any platform now.
Finding the tools
First order of business: If you haven’t already, download the latest development version (4.3pre10) of the jEdit Mac OS X package from jEdit.org (Don’t worry about the “development” vs. “stable” bit… The development version has been in the works for years, and yes, it’s stable now. These guys are careful). Install it (I won’t bother telling you how; they’ve got instructions if you need them), and launch it.
I’ll go ahead and warn you: At first glance, jEdit isn’t exactly beautiful. It’s a cross-platform editor, and therefore some of the interface design is not exactly what one might expect from a mature Mac application. But don’t worry, over the course of this series, we’re going to change that!
To begin our long journey from ugly duckling to ActionScript swan, we’ll need a few readily available plugins. Installing them is simple: Under the Plugins menu, choose Plugin Manager… and make sure you see the following items in the list: Console, Project Viewer, Sidekick, CtagsSidekick. If you don’t see them (and you probably won’t see all of ’em), no problem: Just click the “Install” tab in the dialog box, wait for the ever-growing list of free plugins to appear, and select and install each of them. We’ll come back for more later, but for now, this should get us started.
Out of the box, jEdit comes with full syntax-highlighting support for ActionScript 2. That’s nice, but it’s not enough. Fortunately, we can thank Jesus Gollonet for creating an ActionScript 3 edit mode for jEdit just last month. Download the file from his site, and save it in your ~/.jedit/modes folder (If you don’t know what that means, read on to discover just where to find this file).
A little housekeeping beforehand
Ok, to fully customize jEdit to our tastes, we’re going to get our hands a little dirty with some old-school shell scripting (fortunately, jEdit is great at doing this, too). To keep everything together, I prefer to save my extra files in a subdirectory of the same folder in which jEdit keeps its settings. Unfortunately, the jEdit settings are (by design) inside a hidden folder (specifically, ~/.jedit), so unless you’ve already got your system set up to expose hidden directories, we’re going to have to take a few steps to get there (It’s never easy, is it?).
The .jedit folder is located in your home directory (which itself is abbreviated as “~” in *nix-based systems and indicated by the house-shaped icon in the OS X finder), but it’s usually not available to the casual user. It’s easy enough to get to in a number of ways, though (Hint, read to the bottom of the following list for the “easy” way):
- Go through the normal convoluted processes to show all hidden files, as discussed here (Not recommended)
- Open a Terminal window and enter
open ~/.jeditto get there through a command line. (Nerd sexy, but not necessary), or…
- Use the Finder’s little known Go>Go to Folder menu command (or hit Shift-CMD-G) and type ~/.jedit as shown:
Regardless of how you get there, once there, you might as well make it easy on yourself next time (you’ll be spending a lot of time here until you get everything set up just right) by making a visible shortcut. To do this, drag the small icon from the top of the folder’s finder window to wherever you want the shortcut (I suggest the Finder’s sidebar for quick access from anywhere).
Note: On Windows, I think the equivalent directory to ~/.jedit is C:\Program Files\jEdit, but I won’t swear to it.
Ok, now we at last want to create our own ~/.jedit/launchers subfolder in which to place the shell scripts and other support files we’re going to make later. I called my folder “launchers,” and to make things easy, you might as well too.
Ok, let’s do something with Flash today
Now that this bit of housekeeping is out of the way, let’s make jEdit do something Flash-y. For starters, how about making the familiar CMD-ENTER key combination test the current movie in Flash? Sure, we could do this in a traditional Mac manner using AppleScript or Automator, but we’re Switchers, aren’t we? So let’s keep it cross-platform and do it the old fashioned way (mainly because this is the way I did it the first time).
To do this, we’ll need to create a Flash JSFL file that simply tells the Flash IDE to “Test Movie.” Then, we’ll create a jEdit macro to execute this command at will. Finally, we’ll want to assign this new macro to our old friend, CMD-ENTER (or F6 for you FlashDevelop veterans).
This is simple enough: In your favorite editor (I suggest jEdit), save the following line in a new file named flashtest.jsfl and save it in your new launchers subfolder (Good news! if you can’t find your hidden .jedit folder in the jEdit Save File dialog box, simply right click inside the dialog box and select “Show Hidden files.” They thought of everything):
Ok, so that’s the file that lets Flash know what to do. But now we need to let jEdit know how to launch that file. In other words, we need a macro to launch flashtest.jsfl from jEdit. Easy enough! Save the following file in ~/.jedit/macros/Test_in_Flash.bsh:
// Save this file to your hidden ~/.jedit directory
// as "Test_in_Flash.bsh"
// This will cause the command to appear under the
// Macros directory as "Test in Flash." You can
// then assign a Shortcut key (such as CMD-ENTER
// or F6) using jEdit>Preferences>Shortcuts>Macros.
// Note: In order to use this macro, you'll need jEdit's
// "Console" plugin installed
Ok, so that actually provides the mechanism by which jEdit can tell Flash to “Test Movie.” Once you’ve saved this file, you can see the new Test in Flash item under jEdit’s Macros menu, and you can use jEdit>Preferences>Shortcuts>Macros>Test in Flash to assign the CMD-ENTER and/or F6 keys to the macro itself. Tada!
Go ahead and try it!
Not so fast there…
So did it work? Or did it just launch Flash and do nothing? Note that you will still need to have the relevant FLA file open in Flash before running this macro, so Flash will know which FLA needs its attention (This is common to any text editor, I believe).
I guess we might as well teach jEdit to open FLA files in Flash for us, too. Stay tuned for the next update!