Despite appearances it’s very easy. All you need is Flex SDK which is available for download on Adobe site. There are sufficient tools in this SDK to compile ActionScript 3 code into single SWF file. Furthermore there is no problem to embed resource files (MP3, PNG) with it. I assume that you have Linux operating system and you are familiar with using the terminal. Obviously you have to know ActionScript 3 basics at least.


Create directories for sdk, projects and scripts

mkdir -p /home/$USER/AS3/sdk
mkdir /home/$USER/AS3/projects
mkdir /home/$USER/AS3/scripts

Download Flex SDK (latest version is 4.6). You can find it here Unzip it into sdk directory

unzip -d /home/$USER/AS3/sdk

For convinient work add some paths to shell rc script. Example for bash

echo "PATH=\$PATH:/home/$USER/AS3/sdk/bin" >> ~/.bashrc
echo "PATH=\$PATH:/home/$USER/AS3/sdk/runtimes/player/11.1/lnx" >> ~/.bashrc

Untar Flash Player

cd /home/$USER/AS3/sdk/runtimes/player/11.1/lnx
tar zxf flashplayerdebugger.tar.gz

Reload shell rc script

source ~/.bashrc


Create a directory for test code and file named in there. Fill it with sample code I provide below. For now you can just use your favorite text editor as EDITOR but in the future I will show you how to fit vim for comfortable work with ActionScript.

mkdir /home/$USER/AS3/projects/Test 
EDITOR /home/$USER/AS3/projects/Test/

Sample code

package {
	import flash.display.Sprite;

	public class Main extends Sprite
		public function Main():void
			with(graphics) {
				lineStyle(1, 0xff7979ff);
				moveTo(10, 10);
				lineTo(100, 10);
				lineTo(100, 100);
				lineTo(10, 100);
				lineTo(10, 10);



For now we are ready to compile test code

cd /home/$USER/AS3/projects/Test/

During compilation you will get warning

This compilation unit did not have a factoryClass specified
in Frame metadata to load the configured runtime shared libraries.
To compile without runtime shared libraries either set 
the -static-link-runtime-shared-libraries option to true 
or remove the -runtime-shared-libraries option.

If you don’t want to see this warning just add option to compilation

mxmlc -static-link-runtime-shared-libraries=true

Anyway if there weren’t errors, file named Main.swf should appear in the Test folder. You can run it by command

flashplayerdebugger Main.swf

The result should be Adobe Flash Player window running Main.swf file and there will be blue rectangle on white background. As you can see the compilation isn’t very fast and each recompilation of the same code (or with small changes) takes the same time. In the next post I will show you how to speed up this process by using fcsh shell with fcshc script.