Who This is For
This post is primarily for anyone that has to use Eclipse for actionscript programming, which is primarily for Mac, Linux, or even PC users who would rather use the eclipse platform.
FlashDevelop is only supported in windows (programmed using C#), so if using a Mac or Linux, you would have to use Eclipse with the Flash Builder plugin, or the Flash Builder, or for Mac users, code in the Flash IDE (CS3, CS4, CS5, ect).
Continuing
In the previous section, I listed pros and cons of creating games in ActionScript, as well as useful terms you may encounter when programming in ActionScript.
In this section, we will download and install Eclipse (with the Flash Builder Plugin), and create our first program.
(NOTE: I installed using windows, but using a Mac or Linux should be something somewhat similar — I’ll later try to borrow a Mac, and install Ubuntu to have screen shots from them as well)
Downloading and Installing Eclipse and the Flash Builder Plugin
Go to: https://www.adobe.com/cfusion/tdrc/index.cfm?product=flash_builder and download the ‘English | Eclipse Plugin for:’ whatever your system is.
You’ll have to create an Adobe ID to to be able to download anything from their site.
Next, run it and install it to somewhere on your computer (the default is fine, or install it to ‘C:\Eclipse_with_FB’.
Once it finishes installing, you should have a link start up Eclipse with the flash Builder Plugin, or you can start it up by going to the folder: ‘eclipse-host-distro’ and running ‘eclipse.exe’.
It will ask you for what workspace you want to use– I just created a sub folder in the folder where I installed Eclipse with the FlashBuilder Plugin named ‘WorkSpace’.
Once it starts up, go to ‘File->New Project’, double click ‘Flash Builder’ and double click ‘ActionScript Project’.
Type in a project Name of ‘FirstGame’, and click ‘Finish’. It will ask you if you want to change to the ‘Flash Perspective’, so click ‘Yes’.
You’ll get a new window with a tab in the center of the screen called “FirstGame.as”. Add the line of code below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | package { import flash.display.Sprite; /* @author Chris */ public class FirstGame extends Sprite { public function FirstGame() { //this will output to the "Console" window below by ASDoc trace("this is my first game"); } } } |
Now run/build and compile your program (F11 or click on the green ‘Play’ button under the ‘Navigate’ Menu on the top). Run it as a web application, and it will open a new webpage with a blank, white window.
But if you look in the Eclipse Window, under ‘Console’ on the bottom, you’ll see that it ‘traced’ out the first column!
This compiles the code in that file into a swf file and places it in your folders ‘bin-debug’ folder.
Trace is used to ‘debug’ your program– you can output text, variable values, and can check to make sure you can see what is happening in your program.
The end user can’t see these outputs, it only shows up while running inside of Eclipse.
Commenting
When you want to make a note in your code, but don’t want it to affect your program, you use commenting.
There are two ways to comment, the first is used to comment out the whole line. Use ‘//’, two forward slashes, and it will comment out everythign afterwards on that line.
You can see that being used above for ‘//this will output to the “Console” window below by ASDoc’. The two forward slashes are looked at by the compiler, realizes that it is not code that needs to be compiled, and skips the rest of the line.
The second way is able to comment out multiple lines, or a big block of code. Start it by using ‘/*’ (forward slash and a asterick), and end it using ‘*/’ (asterick and a forward slash).
An example of this can be seen above around the lines enclosing the ‘@author Chris’ block.
Comments are used to comment out a line that you want to temporarily remove, or to add a comment above a section so that you know what is going on, or so that other people can see easily human readable advice on what is happening in the program.
Scope (Created by Squiggly Brackets Generally)
Scope is an important programming concept to be aware of. Basically, it’s that variables created in certain places only exist in those places.
Such as vegemite was (lets say) created in Australia, and available in Australia, but the US has no access to it.
You’ll learn more about this later, but in general, if you create a variable inside of squiggly brackets, it only exists inside of the squiggly brackets.
Conclusion
Now you have setup Eclipse with the FlashBuilder Plugin, and have ran your first program, and traced out some text from it.
In the next section, we’ll start going into basic programming ideas that you need to know to be able to program in any language.






It’s all very well saying this is for Linux or Mac, but the link to the Flash builder plugin says nothing about a Linux version, making your page misleading. I came here because I googled “Linux flash game programming”, but it turns out this is of no use to Linux users.
Thanks for letting me know– Sorry about that, I hadn’t realized that they don’t make the plugin for Linux, and discontinued the FlashBuilder version!
I’ll look into finding a way to code in Linux and update the article.
In the mean time, I found this post on installing flashbuilder through wine in linux:
http://blog.hexagonstar.com/setting-up-eclipse-for-flash-development/
Again, sorry about that– eclipse works on all platforms, and I’m surprised that they don’t have the plugin only for Lniux.
No problem. Only just found the rest of your tutorials, and they’re very good, so thanks! By the way, in Linux the easiest solution appears to be to just call the mlmcx compiler (I think that’s the letters in the right order!) directly and do the coding in a regular text editor with syntax highlighting, like Vim or GEdit.