A little howto on setting up your open source AS3 programming IDE, what to download and some installations tips!

      So you want to start programming in actionscript, outside of Adobe CS3? I'd recommend trying FlashDevelop. I use it for all my flash/flex development at the moment, and even when i purchase CS3 or Flex i'll probably still use FlashDevelop for pure coding. It offers a very clean interface, works well and doesn't have to much in the way of clutter. There are other options, such as Eclipse (with FDT Powerflasher) or obviously Adobe Flex Builder 3. I'll be concentrating mainly on Flashdevelop, as i've found this is simple and fairly straight forward to use.

     Firstly, FlashDevelop 3 only runs on Windows 2000/2003/XP/Vista, requires the .NET runtime. And for compiling actionscript you will need the Java runtime and the Adobe Flex SDK. For viewing the swf's you'll need Flash Player 9, and for help with debugging you'll need the Debug version. On the Adobe Flex page, scroll down to the bottom, tick the license term box and the "Download the Flex 3.0 SDK for all Platforms" should turn into a clickable link for you to download (~ 78MB). Once you've downloaded all the nessecary items (you may have a compatible .net or java runtime, so they may not be nessecary) the first thing todo is extract the Flex SDK to a folder. I prefer to extract it to "C:\Program Files\Adobe\Adobe Flex 3 SDK" but you can place it anywhere aslong as you remember where you put it. You may need a utility to extract the zip file something like Iceows, or Winzip or 7-zip depending on your operating system version and installed programs. Install the latest version of FlashDevelop (currently 3.0 beta 6) and then run it. You should see a screen like this

FlashDevelop Start Screen

Next we need to setup FlashDevelop so it knows where to find the Flex SDK. Goto Tools / Program Settings (or hit F10) and under the plugins section, click on AS3Context and enter or browse to the path where you unzipped the Flex SDK (mine was "C:\Program Files\Adobe\Adobe Flex 3 SDK").

 Flash Develop Flex SDK Location Setting

Now to test if everythings hunky dory, we can write the ubiquitous "hello world" test code. Click on "New Project" or if you can't find that, Project -> New Project from the menus. Select "ActionScript 3 / Empty Project" from the available templates, and give it the name "Hello World". Tick the box that says "Create directory for project" if you want this project to have it's own directory (duh) which keeps things cleaner, and also you can change the Location to somewhere else, it usually defaults to your documents folder and then click ok to continue.

FlashDevelop Hello World Project

Now we have the starting point for our first actionscript (AS3) project, we need to add an actionscript source file (.as) to the project so we can add some code. To do this in FlashDevelop, simply right click on the project name in the project manager and select Add -> New Class. If you can't see the project manager window, select View -> Project Manager from FlashDevelops main menus. Our project is called "Hello World" so that is what you should be right clicking on, usually it will say something like "Hello-World (AS3)". A small window should appear asking for a name for the new class to add. For the "main" class in an actionscript 3 program, i usually call it Main.as. You could call it anything, a lot of people use the same name as the project, but i find when you have multiple class in a large project with similar names it becomes more confusing. I guess it's from my C days, as the entry point to the program is called main! Once you've selected a suitable name, press ok and you should be presented with a new tab in the main area called "Main.as" (if thats what you called your new class file).

Hello World Project Main Source FIle

You first need to make sure flashdevelop compiles the main actionscript 3 program file. To do this, you need to right click on the file in the project manager (Main.as) and select "Always Compile" and you should now see a green arrow indicating that the file will be compiled when you build the project. If you can't see the main.as under the project in the project manager window, double click on the project name - "Hello-World (AS3)" and all the files/folders in that project should appear. Imported/included files don't usually need to be set to always compile, but you need atleast one main file set to always compile in order to build a runnable flash swf. Next we need to specify an output swf file to be generated when we build the project. Go to Project -> Properties and enter "Hello-Word.swf" in the Ouput File box then click ok (there are other options here todo with the compiled swf, but you can leave these as default for now).

Hello World FlashDevelop Properties

Now were going to add a line to be executed and produce the message "Hello World" in the debug window. The reason to do this is to verify that the flash debug player is installed and working correctly from Flashdevelop. First we need to change the Main class to be a extended (child) class of "Sprite". This is always needed for the main class, as this is part of the Stage and the main entry point of the flash program. Change the following line

public class Main {

To

public class Main extends Sprite {

If you type that in, instead of copying and pasting - FlashDevelop should add the following line under the "package {" decleration

    import flash.display.Sprite;

If it doesn't, you must add this manually so the compiler knows where the "Sprite" class comes from. Then In the main function, add this line directly under "public function Main() {" add the following

trace("Hello World");

Hello World Code

Now if you try to test the project from Project -> Test Movie (or by hitting F5) and the gods are with you, a new tab should appear with the name "Hello-World.swf" and a load of garbage should appear in the output window at the bottom. If the swf has built and run correctly, and managed to connect to the debug player (if you installed Flash Player 9 Debug Active X) you should see a message saying "Hello World" in the output box. If not something has gone wrong. You'll probably need to check the Flash Player installation, Java runtime, Flex SDK to see they are all correctly installed. Usually you can search the FlashDevelop forums on help if your struggling to get it to work, or you can always post a comment and i'll see if i can help!

Hello World Test Ouput Flash Player 9

If i get time i'll post a few tricks & tips on FlashDevelop if theres any interest, at the moment i really want to start some useful posts about actionscript code itself!