An Actionscript 2 Environment on GNU/Linux
Posted by Dave Hrycyszyn 11th November 2005 in Head LabsThe basics of setting up an open-source Actionscript 2 development environment are detailed very well by Carlos Rovira [1] in his excellent article "Towards Open Source Flash Development." After reading that post, you may be wondering, "Ok, Eclipse is Java-based, this setup should work on GNU/Linux...does it?". Yep. But it's not particularly straightforward.
Install Ubuntu
Here's how to get the FAMES environment working on Ubuntu GNU/Linux [2] - it's a good distro to choose if you're new to GNU/Linux, because it's got Debian's [3] fantastic package management and excellent hardware detection, with (as this is written) a very up-to-date selection of software. I used the Ubuntu "Breezy Badger" preview release [4], but the instructions below should work with any Debian-based GNU/Linux distribution.
I'm assuming that you're familiar with the basics of installing GNU/Linux, using the command line, and using apt-get or Synaptic for package management - a full tutorial about all of these subjects is a little beyond the scope of an article like this one. Do your partitioning, run a base install, and get your security updates. The Ubuntu Forums[5] are a good place to find help if you're having trouble with a basic install. If you're experimenting with GNU/Linux for the first time, take a look through the Ubuntu Guide [6].
Add repositories
Due to patent laws [7] and the goal of maintaining a completely Free Software operating system, the base Ubuntu install doesn't contain some of the key software components you need to get the FAMES environment to run. The non-free Sun Java binaries and the non-free Macromedia Flash Player are the primary things you need from outside the main Ubuntu distro. I'll try to find time to do some testing with fully Free Software alternatives in the near future, but it may still be a while before Actionscript coders can take their rightful place within the ranks of the ideologically pure[8].
As a side note, Actionscripters who care about Free Software [9] should apparently be working on their beards[10] [11] as well as free component sets and class libraries. While growing yours, or waiting for one to arrive in the mail if you don't have the hormones, you can add some extra repositories to your stock Ubuntu install. Fire up a command line and type:
-
sudo gedit /etc/apt/sources.list
This will display your current list of software sources, that is, where your system downloads its software from. Here's my sources.list, you should be able to copy and paste it into your sources.list, save the file, and be in business:
-
# SECTION 1:
-
# The default Ubuntu archives (note that I added the "universe", "multiverse", and "restricted"
-
# repositories as well to get some other packages I wanted, you may not need to do this but it
-
# probably won't hurt you to have some more software to play with.
-
#
-
deb-src http://gb.archive.ubuntu.com/ubuntu breezy main restricted
-
#
-
## Major bug fix updates produced after the final release of the
-
## distribution.
-
deb http://gb.archive.ubuntu.com/ubuntu breezy-updates main restricted universe multiverse
-
deb-src http://gb.archive.ubuntu.com/ubuntu breezy-updates main restricted
-
#
-
## Uncomment the following two lines to add software from the 'universe'
-
## repository.
-
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
-
## team, and may not be under a free licence. Please satisfy yourself as to
-
## your rights to use the software. Also, please note that software in
-
## universe WILL NOT receive any review or updates from the Ubuntu security
-
## team.
-
deb http://gb.archive.ubuntu.com/ubuntu breezy universe main restricted multiverse
-
# deb-src http://gb.archive.ubuntu.com/ubuntu breezy universe
-
#
-
deb-src http://security.ubuntu.com/ubuntu breezy-security main restricted
-
#
-
deb http://security.ubuntu.com/ubuntu breezy-security universe main restricted multiverse
-
# deb-src http://security.ubuntu.com/ubuntu breezy-security universe
-
#
-
# SECTION 2:
-
# The Ubuntu Backports repositories. These provide some java packaging software that you'll
-
# need to build a Debian-compatible Java package from Sun's binary java distribution.
-
deb http://archive.ubuntu.com/ubuntu hoary-backports main universe multiverse restricted
-
deb http://ubuntu-backports.mirrormax.net/ hoary-extras main universe multiverse restricted
-
#
-
# SECTION 3:
-
# The Marillat video repository, which holds Macromedia's Flash Player installer.
-
deb ftp://ftp.nerim.net/debian-marillat/ sid main
-
-
Note: In theory you really only needs Section 2 and Section 3, but I haven't tested this install procedure that way; if you have success doing it that way please let me know.
Don't forget to update your system's list of available packages after changing your sources.list:
-
sudo apt-get update
Note: The repository URLs for the Marillat [12] (http://debian.video.free.fr/) and/or the Ubuntu Backports [13] (http://backports.ubuntuforums.org/) repositories may be subject to change. If the lines from Section 2 and Section 3 in the above sources.list generate errors, go to the websites for those projects and check to see if the repository URLs are the same as what I've got above. In particular, the Ubuntu Backports repositories will probably change soon, as they currently point to the Hoary Hedgehog (5.04) archives rather than the new Breezy Badger (5.10) archives.
Now you can install the Flash player:
-
sudo apt-get install flashplugin-nonfree
(or use Synaptic to do the same thing).
Install Java 1.5
Flashout needs Java 1.5 to run properly, but Ubuntu ships with Java 1.4.2. Installing Java 1.5 on Ubuntu can be a little bit daunting if you've never done it before, there are detailed instructions available on the web, the installation of Java 1.5 works pretty well if you simply follow the first post in this thread [14].
Here's the catch: that process gets you Java, but typing
-
java -version
at a command line tells you, frustratingly, that the system is still using Java 1.4.2. Now, you could enter a really long command line to tell Eclipse to fire up using the correct Java interpreter every time you want to use it, or you could switch the default Java Virtual Machine. I chose the second route, for the sake of convenience. To switch the default JVM to version 1.5, you need to run the following command in the terminal:
-
sudo update-alternatives --all
...and wherever update-alternatives comes up with a java binary that's not version 1.5, select it. You'll get asked a number of times to select what programs to use for a specific function. If it's not a java-related program, just accept the default, but if you see something with java in it, select the java 1.5 option:
-
There are 3 alternatives which provide `java'.
-
Selection Alternative
-
-----------------------------------------------
-
+* 1 /usr/lib/jvm/java-gcj/bin/java
-
2 /usr/bin/gij-wrapper-4.0
-
3 /usr/lib/j2sdk1.5-sun/bin/java
-
Press enter to keep the default[*], or type selection number:
In this case you should select "3".
Install Eclipse
In a rare (for me) departure from apt-get convention, I'd advise you not to bother with getting Eclipse from the Ubuntu repositories. Eclipse has a great internal update system of its own and there's no real reason to depend on apt-get to deal with upgrading all of your finicky IDE settings. Just download Eclipse normally and stick it somewhere like /opt/eclipse (Note: I used this location and the rest of this tutorial assumes that this is where you've placed your Eclipse binary, keep your eyes open when following the directions below if you've put it in a different spot). If you want a more detailed look at the different ways to install Eclipse on Ubuntu, take a peek at the Ubuntu tutorial on the subject, but keep in mind that all I did was go to the Eclipse.org download site and grab the latest, greatest .tar.gz file I could get my hands on (Eclipse 3.1.1 as I write this). Please note that the latest versions of Flashout require Eclipse 3.1 or better.
Install MTASC, ASDT, and Flashout
Installation of MTASC, ASDT, and Flashout works pretty much like it does in the Rovira article[15] or the various tutorials on http://osflash.org [16]. I copied the MTASC binary and libraries to /opt/mtasc/, you can place them wherever you like.
Fix the SWT Error
However, once all preferences are set, and a Flashout file created for the project, double-clicking on the Flashout file to set compilation preferences brings up a notice from Eclipse when you go to view your Flashout file, saying that an SWT error has occurred. This is due to the MOZILLA_FIVE_HOME environment variable not being set. You can set it by editing your .bashrc file.
-
gedit .bashrc
Add these lines to the bottom:
-
# set up a Mozilla environment variable so that Flashout works
-
export MOZILLA_FIVE_HOME=/usr/lib/mozilla
-
-
At this point it should all be working! You can run your new environment by typing
-
/opt/eclipse/eclipse
at a command line, and set up the Actionscript 2 (ASDT), MTASC, and Flashout preferences normally as in the Rovira article.
A More Convenient SWT Error Fix
Opening a terminal and typing "/opt/eclipse/eclipse" at the command line works, but it's not the most elegant solution - an application launcher would be more convenient, but making a new launcher and pointing it to /opt/eclipse/eclipse results in the SWT error coming back. This happens because the launcher doesn't have access to the exported bash shell environment variables. There is a way to do it, though: export the MOZILLA_FIVE_HOME variable in the /etc/environment file. To do this, type
-
sudo gedit /etc/environment
and paste the statements exporting the environment variable into it:
-
# set up a Mozilla environment variable so that Flashout works
-
export MOZILLA_FIVE_HOME=/usr/lib/mozilla
-
-
After logging out of GNOME and logging back in, the MOZILLA_FIVE_HOME variable is now available to everything in the GNOME environment, including any application launchers you make. To add a new launcher, right-click on the taskbar, and select "Add to panel==>Custom application launcher". Enter "Eclipse" for the Name field, and "/opt/eclipse/eclipse" in the Command. Clicking on the launcher brings up the fully-functional Eclipse environment. Don't forget to delete the "export MOZILLA_FIVE_HOME" directive from your .bashrc file!
Getting the MM classes from the Windows partition
If you're dual-booting, you may want to use the Macromedia Actionscript 2 classes from your Windows installation. Depending on what instructions you gave Ubuntu when you went through your partitioning process, your Windows volume may already be mounted on the desktop. If it's not, you can set it to mount automatically at boot time (and mount it right now for immediate use).
At a command line:
-
sudo mkdir /media/windows
Then add a line to your /etc/fstab so that Linux can find your Windows filesystem:
-
sudo gedit /etc/fstab
Assuming you've already made the /media/windows directory, you can just paste in the following line:
-
/dev/hda1 /media/windows auto umask=0222 0 0
-
-
At this point, you could restart the machine to have the Windows partition mount, or you could simply run the following command in a terminal instead:
-
sudo mount -a
A drive icon with the label "windows" should appear on the desktop immediately. After that you can point Flashout and MTASC to your core Macromedia classes in the same way as you would on Windows or OS X.
Search
Categories
- Thoughts
(19)
- News
(30)
- Head Labs
(13)
- Project launch
(10)
- Life at Head
(10)
Monthly Archives
- January 2009 (1)
- December 2008 (3)
- November 2008 (4)
- September 2008 (1)
- August 2008 (1)
- July 2008 (1)
- June 2008 (1)
- May 2008 (2)
- March 2008 (1)
- February 2008 (1)
- January 2008 (1)
- November 2007 (2)
- August 2007 (1)
- May 2007 (2)
- April 2007 (5)
- March 2007 (11)
- February 2007 (10)
- January 2007 (4)
- November 2006 (2)
- September 2006 (4)
- August 2006 (1)
- July 2006 (1)
- June 2006 (3)
- May 2006 (1)
- April 2006 (3)
- March 2006 (7)
- February 2006 (5)
- January 2006 (1)
- November 2005 (1)
Hi! I’ve selected Ubuntu for my desktops (home network), but I’m still shopping for a Server OS (Ubuntu is still missing somewhat in that area).
I would like to use Debian stable (when sarge hits the net), and I saw talks that they will introduce a fixed release cycle like Ubuntu (but 12-18 months).
Can anyone confirm if there is already a decision on that? I dread installing something that is nog going to be updated another 3 years
Thanx for any help)
Usually if you desperately miss something newer than what you have in stable, you can pull it from unstable, or from a backport repository if you wish. Unstable mostly does not live up to its name, single packages from it are usually not horribly unstable.
Good luck with your new server!
Your site is beautiful end accessibility! Thanks again!
It?s very interesting! Greetings. Bye.
I need a free source code which can be equivalent to Flash and will run on linux. can any one help me. plz mail me at chiradipdas@gmail.com. its urgent. plz guyz help me.