Flex on Linux – Hello World Example

December 20th, 2008

Now that adobe have improved Linux support for the flash player (including 64-bit systems) and released the open source flex SDK, its now relatively easy to develop fully fledged flex applications on your Linux machine. This post is designed to be an introduction to get you up and running on flex, more posts will follow with examples from a flex + python + sqllite application that I’m current building using a Linux developement enviroment (Ubuntu / Fedora 64-bit).

First things first you’ll need to get the flex SDK from adobe.com. For some reason Abobe are keen to persuade everyone to do this via their flex builder free 60 day trial. You do not need flex builder to build flex apps, although I’ve played with it and it seems to be fairly well conceived tool i’m not a fan of developing in an application that’ll ill have to pay for after 60 days, thats not really the open source way. So just grab the Flex SDK from:

Adobe Flex SDK (118MB)

You’ll also require the Sun Java Developement Kit (JDK). Please note – it will not work with the native GIJ compiler on Ubuntu. You can JDK 6 from

Sun Java 6 JDK

You’ll need to extract each archive into a directory (in this example use /opt/) Once extacted the two SDKs needed to be added to the PATH. Because flex won’t work with the native GIJ the reference to the Sun JDK needs to occur before the location of GIJ in the PATH. On my system the following export shell/terminal command works fine:

export PATH=”/opt/java/jdk1.6.0_10/bin:/opt/flex/bin:$PATH”

To make sure its worked run java -v in the terminal. This should report the Sun Java version.

This command will need to be run once for each new shell session when you wish to develope in flex. To do this automatically you can added it to your users .profile file.

Test you setup by downloading my very simple hello world flex script

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="start();">
    <mx:Script>
        <![CDATA[
        import mx.controls.Alert;
 
        public function start():void {
            Alert.show('Hello World, this is flex on linux!');
        }
        ]]>
    </mx:Script>
</mx:Application>

Run the flex compiler at the command line:

mxmlc helloworld.mxml

Test the generated swf in firefox

firefox helloworld.swf

hopefully you should see something like this – Hello World Demo

del.icio.us Digg Furl Reddit Ma.gnolia RawSugar Shadows Spurl StumbleUpon Tailrank Technorati

Tags: Flex

RSS feed | Trackback URI

Comments »

No comments yet.

Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line=""> in your comment.

Article Categories

Recent Articles

Recommended

Feeds