With the open source Adobe Flex SDK, developers using any operating system and any text editor or IDE can create rich Internet applications that compile into SWF files. This guide is for those wanting to install and set up the Flex SDK on Ubuntu linux.
What do you need to install Flex on Ubuntu?
- The Flex SDK
- Sun Java (needed for compiling the SWF binaries)
Set up and install Flex
Step 1. If you haven’t already, install Java. (If you aren’t sure, go ahead and try this step anyway.) First open up a terminal (Accessories menu > Terminal) and type the following:
[text]sudo apt-get install java-package sun-java6-jdk[/text]
This will take several minutes while the packages download and install. You’ll also need to agree to Sun’s license.
Step 2. Download the Flex SDK. The rest of this guide will assume you saved the SDK to your desktop: ~/Desktop.
Step 3. We need to create a directory for the Flex SDK. In a terminal window, enter the following:
[text]sudo mkdir /opt/flex[/text]
The “opt” directory is generally where optional application software packages live. (More info on the linux file system.) All we did here is make a new “flex” directory inside “opt”.
Step 4. Now we need to unzip the Flex SDK. Type the following in a terminal window:
[text]
cd ~/Desktop
unzip flex_sdk_4.zip -d tempflex
[/text]
What this does is unzip the contents of your download into a new and temporary directory on your Desktop called “tempflex”.
Step 5. After that’s complete, we need to move these files to “opt/flex” which we’ve already prepared for the SDK. Type the following in a terminal window:
[text]sudo mv tempflex/* /opt/flex/[/text]
This will move the contents of “tempflex” into “opt/flex”. If you want to make sure you moved everything, you can type the following into a terminal window:
[text]
cd /opt/flex
ls
[/text]
You should see a list of all the files in the directory.
Step 6. Last step. All we need to do now is let Ubuntu know where the new Flex compiler lives. Type the following in a terminal window to open up “~/.bashrc” in a text editor:
[text]gedit ~/.bashrc[/text]
The text editor will open your ~/.bashrc profile and we only need to add one line (I added it at the bottom of the file, but I’m not sure it matters).
[text]export PATH=/opt/flex/bin:$PATH[/text]
Save the file and close the text editor. Then exit all open terminal windows before opening a new one. This should ensure that your terminal loads the path that we just added.
You should now be able to compile your Flex projects with the “mxmlc” compiler command. To make sure, type the following in a terminal window to bring up the “help”:
[text]mxmlc –help[/text]
Looks good? Great. You’re all set. Happy Flex-developing.
Subscribe to the feed
Subscribe by email
thanks
easy to follow and helps.
Glad to help.
My Windows installation crashed and burned on my home box and I had no desire to go back. Still needed to be able to do AS3 at night. Out of all the stuff I have waded through trying to get a reasonable set up of flex running, this by far has made the most sense and has been the most complete. Thank you!
You’re very welcome. Sorry to hear about your Windows system.
Thanks a lot!
One small issue is remaining for me: after setting mxmlc as executable via ‘chmod 755 /opt/flex/bin/mxmlc’, I now get the following error when starting mxmlc:
‘bash: /opt/flex/bin/mxmlc: /bin/sh^M: bad interpreter: No such file or directory’ although /bin/sh exists of course. Thanks for any suggestion!
Hi Tom. Not sure if you’ve solved your issue yet, but a quick Google search of your error brought me to this site. The author apparently fixes the issue with the following commands:
sudo apt-get install tofrodos
sudo dos2unix /opt/flex_sdk_3/bin/mxmlc
Thanks a lot, this solved the issue.
In ubuntu 10.4 use
sudo fromdos /opt/flex_sdk_3/bin/mxmlc
instead of sudo dos2unix /opt/flex_sdk_3/bin/mxmlc
there are many more complicated how to’s outthere, this one is really nice and works quite well. thanks a lot for that
Hello ,
Thank you for the great tutorial , though
I go through the tutorial steps so far and everything is working great except It does not see adl file in my ubuntu installation in order of this command
rake air:build
when trying out this Restfulx.github.com , building a standalone AIR application .
giving me this error :
hamza@hamza-laptop:~/apptemp/ttt$ rake air:run
(in /home/hamza/apptemp/ttt)
Compiling /home/hamza/apptemp/ttt/app/flex/Ttt.mxml
Loading configuration file /opt/flex/frameworks/air-config.xml
Loading configuration file /home/hamza/apptemp/ttt/app/flex/Ttt-config.xml
/home/hamza/apptemp/ttt/app/flex/Ttt.swf (500672 bytes)
Moving /home/hamza/apptemp/ttt/app/flex/Ttt.swf to /home/hamza/apptemp/ttt/bin-debug
Created /home/hamza/apptemp/ttt/bin-debug/Ttt-app.xml descriptor.
Done!
Running AIR application with descriptor: Ttt-app.xml
Could not run the application with descriptor: bin-debug/Ttt-app.xml. Check console for errors.
what do you think !?
Hi , dat’s awesome.. it was grt… tutorial i like it
thanks,
this line in one of your comments did the trick for me:
sudo dos2unix /opt/flex_sdk_3/bin/mxmlc
was struggling with this part.
Thank you for this tutorial! I always wanted to develop Flash on linux
Thanks for the tips – I don’t think I’ve ever had thought of that dos2unix bit. But what on earth is mangling the line endings? ZIP?
Thanks a lot Steve Love
. It works!
Thnx for this neat tutorial, it was very helpful!
thanks a lot steve…i works and i can do my work again
Just a quick message to say “Thanks!” for an excellent and speedy tutorial!
Also, to give back, I can confirm that this works in the new Lucid Lynx (Ubuntu 10.04) using the OpenJDK JRE (rather than Sun’s, which has now been moved to the multiverse) and the new Flex SDK 4 that can be downloaded from:
http://download.macromedia.com/pub/flex/sdk/flex_sdk_4.zip
Thanks again!
That’s great to hear. Thanks for the information, MicroAngelo!
Thanks for the how-to, following it now. But I was wondering why use gksu to edit .bashrc when you’re supposed to own the file anyway?
Most likely just an oversight on my part. Thanks for pointing it out.
Would love it you had given a sample “Hello World” flash code to compile. Thanks anyway.
[...] I’m trying to use Open Source solutions for resource development more and more lately, and most recently switched to Linux (Ubuntu) on my laptop with a view to Flash development with the free Flex SDK. Developer Steve Love has an excellent blog post on doing the main setting up here. [...]
when I type in mxmlc –help it tells me mxmlc command not found
Did you close all console/terminal windows before trying the command?
I had the same problem and i resolved it with
sudo apt-get install tofrodos
sudo fromdos /opt/flex_sdk_3/bin/mxmlc
Thanks a lot for this article!
Now I can generate Linux versions of my application JEPUM, which is being requested in the Linux community.
Good tutorial. Worked fine with FlexSDK_v4.1 But…
…
Binary for v3.5 seems totally incompatible with dos2unix, at least with Fedora 13×64 OS I’m using now.
Had some compile errors with v4.1 and wanted to go back to v3.5 when the code I’m working with was written. No luck, tons of theme errors so lots of find-replace to do
I’ll keep working on getting v3.5 to work.
Thanks.
jerry
Great tutorial, simple instructions and worked perfectly first time, thanks!
hi
This very useful!
Thank you.
hi there. thanks for the tutorial. i followed the steps for ubuntu 10.04 but i’m getting the following error:
/bin/sh: Can’t open /opt/flex/bin/mxmlc
any help will be greatly appreciated! ARGH!
This is a great tutorial, thanks for writing it Steve. The setup worked perfectly.