Flash development on Linux - Setting up the environment
I have been developing Flash (Actionscript/Flex) applications on Linux for a couple of years now and I think it is a good platform to develop flash on. In this article I will show you how to get the development environment up and running using totally free tools so you easily can start developing your flash software. This tutorial is totally distribution agnostic so you can do this on any flavor of Linux, for reference I am using the latest Fedora.
Prerequisites
First of all you will need to get the installation packages. I will show you later how to install them but for now just download the packages and place them in some convenient download folder. You will need the following:
-
Eclipse 3.5 - Download here
-
Flex 4 SDK - Download here
-
Flex 4 SDK dependencies - Download here (rename to flex4dependency.zip)
-
FB4Linux - Download here (Download FB4Linuxaa, FB4Linuxab, FB4Linuxac and FB4Linuxad)
-
Flash Standalone Debugger - Download here
Installation
So now that we have all we need to install, lets get to it! I am going to put all the installed packages in a "programs" folder which path is for me /home/john/Programs. Of course you will need to change this path to suit your own setup.
We will start by installing Eclipse. Installing eclipse is fairly simple, you just extract the installation package and move the folder to where you want it. I will use the command line in this tutorial but the same can be achieved via GUI tools as well. So I open a command line and issue the following:
tar xzvf eclipse-SDK-3.5.2-linux-gtk-x86_64.tar.gz
mv eclipse /home/john/Programs/fb4linux
What I did was extracted the download package which yields a folder named 'eclipse'. Then I just move it to my programs folder and rename it 'fb4linux'.
Next we are going to install the Flex SDK with its dependencies. The Flex SDK contains the compiler that we need to compile our actionscript source code into SWF files. Let's start with the dependencies. Issue the following:
unzip -d /home/john/Programs/fb4linux/plugins flex4dependency.zip
That will extract the dependencies into the eclipse plugin folder where they can be found by eclipse. Now, that the dependencies are in place lets install Flex 4 SDK. To do that you will need to extract the downloaded file into our programs folder similarly what we did with eclipse. So, issue the following:
unzip -d /home/john/Programs/Flex4 flex_sdk_4.0.0.14159.zip
Good. Now we have the basics set up. Time to install FB4Linux IDE on to Eclipse. But what is FB4Linux exactly and why do I need it?
Since sadly Adobe discontinued releasing FlexBuilder for Linux when it reached version 4 (and changed its name to FlashBuilder) a project named FB4Linux emerged where people are trying to port FlashBuilder to Linux. With FB4Linux you get all the essential tools to help you in your development like auto-completion, project templates and compiler automation. This makes developing with any language much more fun. What I don't understand however is why they have decided to chop up their installation tar package into four binary files. I really don't see any benefits in it and it just complicates matters, why not just make it a rar for instance and have the rar compressor split it up in four pieces instead if that really is needed?
Anyway, to combine the four binary pieces and extract the archive issue the following in the console:
cat FB4Linuxa* > FB4Linux.tar.gz
tar xjvf FB4Linux.tar.gz
mv "Adobe Flash Builder 4" /home/john/Programs
That will first create a 'Adobe Flash Builder 4' installation folder in the current directory and then move it into our programs directory. Now lets launch eclipse and install FB4Linux.
cd /home/john/Programs/fb4linux
./eclipse
The first thing you need to do is enable the Eclipse installer to use the classic way of installing plugins, so go to Window->Preferences->General->Capabilities and enable Classic update. Then exit preferences by clicking OK. Next, open up Help->Install New Software. Click the Add button and type in the following:
Name: FB4Linux
Location: file:/home/john/Programs/Adobe Flash Builder 4/eclipse
And select OK. That will close the add dialog and return to the Available software screen. If our added site is not selected in the "Work with" selection box select it now. Then you should unselect the "Group Items By Category" checkbox and hopefully you should now see some installable packages in the middle of the screen. Mine contained the following:
Adobe Flash Builder Core Feature
Adobe Flash Builder Localized Core Feature
Common Flex IDE Feature
Common Flex IDE Utility Feature
Localized common feature
Select them all and press Next.
It will calculate the dependencies and show you the install details. Press Next again.
Accept the license and finally press Finish. This will start the installation process which takes a while. If it asks about the validity of the packages or to accept the certificates just press OK. Once it is done you should restart eclipse.
Configuration
Now that FB4Linux is installed we need to configure it a bit. Lets start by configuring the Flex compiler. Open up Window->Preferences->Flash Builder->Installed Flex SDKs. There will be two broken one already in the list so start by removing them both by selecting each one and clicking Remove. Now that the list is empty, click Add and enter the following details:
Flex SDK location: /home/john/Programs/Flex4
Flex SDK name: Flex 4.0
Click OK. Then you should select the just added Flex SDK as the default one, by ticking the checkbox beside it.
Now close the preferences by clicking OK.
Finally, we are going to install and configure the Flash Standalone Debugger which we use to launch our application directly from Eclipse. To do that lets first unpack it and move it to our programs directory. Using the console type in the following:
tar xzvf flashplayer_10_sa_debug.tar.gz
chmod +x flashplayerdebugger
mv flashplayerdebugger /home/john/Programs
Now lets set up a launch task in eclipse. In eclipse open Run->External Tools->External Tools Configuration. Select the Program item and click the New button. Enter the following details:
Name: Flash Debugger
Location: /home/johnnie/Programs/flashplayerdebugger
Working Directory: ${workspace_loc}
Arguments: ${selected_resource_loc}
Finally, lets open up the Flash Builder perspective so we can start developing. Select Window->Open perspective->Other and from the list select Flash and click OK.
And there you go, a full Flash development environment on linux at your disposal.