Twitter Trends: Experimenting with Adobe Air

Now that there are a couple of Adobe Air applications in my regular toolbox ([Tweet Deck][], in particular), I figured it was time to find out more about how Air works.

I knew you could create Air applications with [Flash][] (and also [Flex][]), but I was pleasantly surprised to see that you can also create Air applications with [HTML/Ajax][].

After working through the [Air SDK tutorial][], I set about writing a simple Air app that interacts with the [Twitter API][].

Step 1: Download & install the [Air SDK][]

The SDK has all of the tools for debugging & packaging Air apps. This is especially useful for HTML Air apps when you're just working from a text editor.

Step 2: Create the application descriptor file

Every Air app has a descriptor XML file which specifies the application name, version, window size, etc.

~~~~ {.xml name="code"} testing.html.TwitterTrends 0.1 TwitterTrends TwitterTrends.html true 300 400 wzxhzdk:0

The HTML is pretty basic as well

~~~~ {.html name="code"} Twitter Trends

Twitter Trends


Step 5: Run it!

To run the app in debug mode, run adl *application-descriptor-file* (found in the bin directory of your AirSDK install).


adl TwitterTrends-app.xml

If all goes well, you should see something like this:

![Twitter Trends app window][]

You'll also notice some debug messages (courtesy of the air.trace() function) in the terminal window where you ran the adl command:

![debug message][]

Step 6: Package it up

Once you have a working app, you might want to actually share it with other people. The first step is to create a self-signed certificate to sign your app with (using the **adt** program in the bin directory of the SDK).


> > adt –certificate -cn SelfSigned 1024-RSA sampleCert.pfx samplePassword > >

This creates a certificate file **sampleCert.pfx** which has a password of *samplePassword* that you can use for signing your Air application. And now you can actually package the whole thing up:


> adt -package -storetype pkcs12 -keystore sampleCert.pfx > TwitterTrends.air TwitterTrends-app.xml TwitterTrends.html > AIRAliases.js prototype- scriptaculous.js effects.js > >

The basic format of the command is **adt** -package -storetype pkcs12 -keystore *certificate-name* *output-air-filename* *list-of-all-files-in-the-app*. Note that you have to explicitly name **every** file to be included in the app. Thus concludes our brief Adobe Air tutorial. You can download a [.zip file][] with all of the files used in this example, including the sample certificate and a batch file for packaging things up. [Tweet Deck]: [Flash]: [Flex]: [HTML/Ajax]: [Air SDK tutorial]: [Twitter API]: [Air SDK]: [PrototypeJS]: [Scriptaculous]: [Google Code]: []: [Twitter Trends app window]: [debug message]: [.zip file]: