Setting up Open Source Flex SDK with debugging on Ubuntu

Step by step instructions for setting up Open Source Flex SDK with debugging on Ubuntu.


Download the Flex SDK

http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK

I downloaded the file flex_sdk_4.1.0.16076.zip

Unzip and install Flex

Unzip, move to /opt/ and create a link named flex to it


unzip flex_sdk_4.1.0.16076.zip -d flex_sdk_4.1.0.16076
sudo mv flex_sdk_4.1.0.16076 /opt/
ln -s /opt/flex_sdk_4.1.0.16076 /opt/flex

Optionally you can add the Flex bin directory to your path. There are a few ways to do this but I like to add the path to my environment file


sudo nano /etc/environment

Add :/opt/flex/bin to the end of the path. The reload the environment.


source /etc/environment

Download the Flash player with debugger

http://www.adobe.com/support/flashplayer/downloads.html

I downloaded the player content debugger flashplayer_10_plugin_debug.tar.gz

Unzip this file to get the libflashplayer.so file.

Rename the libflashplayer.so file in your /usr/lib/flashplugin-installer/ directory, the copy the new libflashplayer.so to this location.

Create and compile a Flex app

Create any simple Flex app that uses the trace() function. I used this one from the online Flex 4 docs – file name hello.mxml:


<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark">

<fx:Script>
<![CDATA[
private function writeToLog():void {
trace(myText.text);
}
]]>
</fx:Script>

<s:VGroup id="myVGroup">
<s:TextInput id="myText"
text="Hello World!" />
<s:Button id="mybutton"
label="Say Hello"
click="writeToLog();"/>
</s:VGroup>
</s:Application>

Compile this with the –debug option


mxmlc --show-actionscript-warnings=true --strict=true --debug=true hello.mxml

This creates a hello.swf file

Running and debugging

Open a terminal window and run the Flex debugger


fdb

Within fdb start a debug session with the run command


(fdb) run

Open hello.swf in your browser.

You should see a dialog window ‘Where is the debugger or host application running?’

* Choose localhost
* Tick don’t show this dialog at launch
* Click Connect

Go back to the terminal window and type ‘continue’


(fdb) continue

Your should be able to use your flex app and see your debug trace statements in the terminal window.

If you take too long between running the debug process and connecting via the browser then the session will automatically end, so you might need to try again.

This entry was posted in Flex and tagged , , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.

2 Comments

  1. Danny Anderson
    Posted January 23, 2011 at 4:08 am | Permalink

    Helpful article. I’m not 100% there, but I’m seeing interaction between the debugger and the hello app. One minor correction:
    ln -s /opt/flex /opt/flex_sdk_4.1.0.16076 has the target and source reversed.

  2. Posted January 24, 2011 at 10:48 pm | Permalink

    Thanks Danny, fixed.

One Trackback

  1. [...] up and running! Download Free Adobe Flex SDK Great Video how to install Adobe Flex SDK on Mac OS X Create and compile a Flex app, and how to debug using trace() Adobe Flex website 54.510893 -6.042726 Filed under Flex SDK ← Flex SDK Pitfalls [...]