Flash/ActionScript3 “Programming” under Ubuntu
By: Thierry Nicola
Tags: Actionscript 3, Linux, Programming, Webtech

I am working as a Software Engineer at L//P (as a freelance). It is a lovely company doing some high-level web development. I am currently working on some Flash projects. And Flash is actually the only reason I need to boot into Windows. Adobe Flash is becoming a real nice tool to create Web stuff(Games, Sites,…) It is easier to program as developers don’t need to worry about which browser the visitor has. Ajax can be quite some pain, if you want to make it look and work the same in every browser. Flash 9 is becoming more interesting since ActionScript 3. This programming language is a great improvement in contrast to AS2. When I started with AS2 it was quite a pain and I sometimes thought I would go crazy, as my Computer started to make some real crazy stuff. And every time I compiled the same program, it behaved differently.(One day Flash executed code which was commented out) And the Flash IDE is completely useless for programmers, it is just doing syntax highlighting and nothing else.

It is possible to get rid of the Flash IDE and use the FLAME for Ecilpse(Compiler, ASDT and Flashout). So you did only need the Flash IDE to create the Flash project. It is available for Windows and Linux.

Now Adobe released an ActionScript3 compiler for all platforms. Meaning you can compile your Flash movies with the official compiler on Linux. I was very nervous to try this out. So I will shortly explain how you can build your swf Flash movies in Ubuntu.

What we need

GEdit

Flash Player 9 (for Firefox)

ActionScript 3 Compiler

First, you are free to use any text editor available for Linux. I use GEdit as I really like this little editor. With the correct plugins GEdit becomes a powerful editor for programmers. First of all, we want our ActionScript 3 code to look as good as it does with the FlexBuilder. So I created an ActionScript 3 language file for GEdit(mainly for personal use but you can get it here).

Then you have to install the Adobe Flash Player 9 for Firefox. As there are many HowTos around for doing so I will redirect you to one. Click here for a good Howto.

Finally, what we need is the compiler, the free Flex SDK 2.0.1. Go to the adobe site and download the .zip Archive.(http://www.adobe.com/products/flex/downloads/) Remember where you downloaded your file. I created a new directory in my home .flex, where I extracted the .zip archive. Then go to this directory, cd .flex/bin, and make the compiler executable, chmod +x mxmlc. That’s it, you have got everything you need to start programming ActionScript 3 and create your own swf movies.

Getting Started with the Hello World!

As usual, let the first application be the Hello World! test. Open your editor of choice. And enter the following code. This is not an ActionScript 3 tutorial, if you want to learn on how to use AS3, I refer you to some other tutorials(in the References section below).

package {

import flash.display.Sprite;

import flash.text.TextField;



public class HelloWorld extends Sprite {



public function HelloWorld() {

var display_txt:TextField = new TextField();

display_txt.text = “Hello World!”;

addChild(display_txt);

}

}

}

Save your file as HelloWorld.as. Now change directory to where your compiler is located, cd ~/.flex/bin. And then simply execute ./mxmlc ~/path/to/your/file/HelloWorld.as. A HelloWorld.swf file is created in the same folder, where your HelloWorld.as file is located. What needs to be done is to redirect Firefox to the swf movie and VOILA! Have Fun to develop FLASH/AS3 under Linux!

REMARK: Some say it is possible to run Flex Builder on Linux, here .