Get started with Flex development on Linux

Hi everyone!

This post is meant to be a simple tutorial about how you can get started with developing Flex applications on your Linux machine. Before we dive into the tutorial itself let me just make it clear that the way I’m going to present here is not the only one. You can start developing Flex on Linux by downloading Flex Builder from Adobe. The reason why I don’t use it is that it seems that Adobe has put the development of the Linux version of FB away for a while. The available FB is still in alpha version and hasn’t been updated for quite some time. That unfortunately means you can’t use it with the latest Eclipse (FB for Linux comes as an Eclipse plugin). Anyway, let’s get started.

What you will need for this tutorial is:

I run Linux Mint 7, Komodo Edit 5.1.4 and the open source version of Flex SDK 3.4.

First install Komodo Edit. Start the IDE and go to Tools/Add-ons (just like in Firefox ;-) ). Make sure an extension called MXML Language is installed. If not go to Get Add-ons tab and search for it and then install it. Once you have the extension running you can easily create .mxml files and Komodo will help you writing them by enabled Code Intelligence.

Komodo screenshot

Komodo's MXML support - screenshot

Once you have tested Komodo’s support for Flex/MXML you need to make sure you can actually create (or compile) Flash files. For that you will need to get and set up Flex SDK. To download it follow the link on the list above. When downloaded, simply extract the archive (zip) to a location you prefer. Make sure you know where it ends up because it’s sort of crucial. The most important thing is the bin directory within the flex_sdk_nnn. In the bin folder there is the MXML Compiler – mxmlc. This small application is used to compile your mxml code and create a Flash file (swf). The compiler needs to know where java lives. To make it aware of that you need to edit one file within flex_sdk/bin directory (the same where the compiler is located). The file is called jvm.config. Open it in your favourite editor and look for the line java.home=. Add path to java directory, in my case it’s /usr/lib/jvm/java-6-sun/, and save the file. The final result should be: java.home=/usr/lib/jvm/java-6-sun/

We are not going to use the terminal to run the compiler. Instead we’ll run it from within Komodo! To do this go to Tools/Run Command. A window comes up asking you for the command to run. This is what you should enter:

/full/path/to/flex_sdk/bin/mxmlc “%D”/yourfile.mxml

In plain English, if you have your MXML Compiler in /home/tom/flex_sdk/bin and the file to compile is called main.mxml the line above would look like this:

/home/tom/flex_sdk/bin/mxmlc “%D”/main.mxml

command properties screenshot

Command Properties in Komodo - screenshot

If you wonder what “%D” means here comes the explanation. It stands for the current directory or root directory of the current project.

To make things simpler for yourself tick the Add to Toolbox option at the bottom left of the window. You can now run the command. If you opted for adding the command to the toolbox it should appear there (open the right side panel). Right click the command in the Toolbox and choose Properties. In the Properties window you can choose another name for the command, like Build Flex, and change the icon if you so wish. On the Key Binding tab you can add a key sequence to run the command, which simplifies things a lot. Click OK and you’re done.

When you run the compiler an swf file should be created in the folder where your mxml file is located. You can view the swf file in Firefox or any other browser of your choice (that has a flash plugin installed).

If the compiler doesn’t run double check the paths, both to the compiler and to the mxml file.

Thanks for reading this tutorial. Now good luck developing Flex applications! Please leave your comments below.

2 thoughts on “Get started with Flex development on Linux

  1. Pingback: Back to Netbeans «

Comments are closed.