Creating the simplest ever AIR application in FDT4 for Linux

Setting up FDT4 for developing an AIR application should be easy. However there is a paucity of information on how to do this on the web in a simple and concise way. A lot of the information for the set up in Linux is out dated and tends to lean towards a time when the AIR sdk support for Linux was fragile at best and thus you needed to fiddle and twiddle with the AIR SDK in order to gain any success. After googling, yahooing and binging for information as well as ploughing through Adobe and other sources of information I found that its actually quite easy to develop an AIR application in Linux. This method has been tested in FDT4 and FB4Linux - the unofficial port of the Adobe FlashBuilder4. The operating system is Ubuntu Maverick 10.10 64bit.
You need to have the following:
  • FB4Linux or FDT4 or both (I have both).
  • The very latest AIR SDK
  • The different Flex SDK's for Flex/Actionscript developement - try Adobe Hero the latest Flex SDK
The procedure is as follows using Adobe Hero:-
Setting up the IDE for AIR development:
  1. Download the latest SDK for the AIR
  2. Download the Adobe Hero Flex SDK
  3. Unzip the Adobe Hero SDK into your Flex SDK folder. This is the folder that FB4Linux and FDT4 reference the target SDK for compilation reside.
  4. Open FB4Linux and/or FDT (dependent on your choice of IDE). Using your IDE, assign the target SDK to the IDE.
  5. Unzip the latest AIR SDK and copy the contents over the target Flex SDK. In my case I unzipped the contents of the AIR SDK over the Flex Hero SDK.
N.B In previous set-up you had to go into theSDK, change the adt and adl in the bin folder to adt_lin and adl_lin. Please do no do this. I found that when I did this FB4Linux could not find the adl to launch the debug  version that you need to see in development. This procedure is no longer needed.

Developing with MXML or ActionScript 3.0
Now that you are set up, use your IDE to create an AIR project. Do not bother about creating the Application Descriptor XML document. In FDT4 and FB4Linux this document is auto generated -Thank God. In FDT4 the document is autogenerated in the bin folder when you launch the debug application. In FB4Linux the document is generated when you create the FlashBuilder AIR project. You're looked after in both IDE's.
The Hero SDK does not add all the necessary bits of the framework by default. You need to go into the project properties - accessing the properties is the same in both IDE's. In FDT4 select the airglobal.swc in the SDK Library. Click the Select button to open it and select the options you need for your AIR application using the check boxes. In the image below you can see the choices I made.




In FDT4 if you want to create the AIR project with Actionscript do the following:
Create an Actionscript class. Call it what you want. For the most basic basic AIR app use the following code:
package {
    import flash.text.TextField;

    /**
    public class AIRtest2 extends Sprite {
        public function AIRtest2() {
            var tf:TextField = new TextField();
            tf.text = "HMMMM an AS3 AIR app";
            tf.width = 150;
            tf.height = 20;
            tf.x = 200;
            tf.y = 200;
            addChild(tf);
        }
    }
}

In FDT4 if you want to create the AIR project with MXML do the following:
Create an MXML WindowedApplication class. Call it what you want. For the most basic basic AIR app use the following code:

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                       xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx">
    <s:Label text="FINALLY!!" horizontalCenter="0" verticalCenter="0"/>

</s:WindowedApplication>


Click on the Debug button in FDT or FB4Linux. Voila, you should see the ADL debug player with your application. This worked for me, I hope it works for you

0 comments:

My Instagram