In this article, I describe the necessary steps for developing Flash/Flex AIR applications on Ubuntu 9.04 64 bits for free.
Flex SDK
You first need the
flex SDK, which is free, and 120 Mb. Unzip it somewhere.
mkdir -p ~/addons/flex/3.4
unzip flex_sdk_3.4.zip -d ~/addons/flex/3.4
Air SDK
The AIR SDK is included in the Flex SDK, but the binaries are for mac. The good ones can be found in the
Air SDK, as well as the air runtime. Copy that into the Flex SDK.
mkdir -p ~/tmp/AIRSDK
tar xfv AdobeAIRSDK.tbz2 -C ~/tmp/AIRSDK/
cp ~/tmp/AIRSDK/bin/* ~/addons/flex/3.4/bin
cp ~/tmp/AIRSDK/runtimes/air/linux ~/addons/flex/3.4/runtimes/air/ -Rfv
Make a sample app
test.mxml :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
horizontalAlign="center" verticalAlign="center">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import flash.display.MovieClip;
private function Test(e:Event) : void {
Alert.show('Blah!');
}
]]>
</mx:Script>
<mx:Button id="myButton" label="I'm a button!" click="Test(event);"/>
</mx:Application>application.xml :
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://ns.adobe.com/air/application/1.5">
<id>test</id>
<version>1</version>
<filename>test</filename>
<initialWindow>
<content>test.swf</content>
<visible>true</visible>
<width>400</width>
<height>200</height>
</initialWindow>
</application>
Make it run
Because the binaries are for 32-bits platforms, you need the ia32-libs package :
sudo apt-get install ia32-libs
Now you can compile your application :
~/addons/flex/3.4/bin/mxmlc test.mxml
And run it :
GTK_PATH=/usr/lib32/gtk-2.0 ~/addons/flex_sdk/3.4/bin/adl application.xml
Information about running 32 bits apps on 64 bits has been found on
a debian related article, and the GTK_PATH in a
bug report thread
And make a movie clip :)
Simply add the required import and the following code to the event handler.
import mx.core.UIComponent;
import flash.display.MovieClip;
var ui:UIComponent = new UIComponent();
var mc:MovieClip = new MovieClip();
mc.graphics.lineStyle(1,0);
mc.graphics.moveTo(0,0);
mc.graphics.lineTo(50,50);
addChild(ui);
ui.addChild(mc);
Enjoy !