Beej's Bit Bucket

 ⚡ Tech and Programming Fun

Adobe AIR

2010-02-17

Adobe AIR is a cross-platform runtime. It enables you to write faux-native (if I might coin a term) apps in Flash, Flex, or HTML/Javascript/Ajax (it uses WebKit for rendering), and then distribute those apps to run on Windows, OS X, and Linux.

It's been out for a while, but I only now just looked at it and installed it on my 64-bit Arch Linux machine... with limited success. Read below for some of the nasty details.

(I don't have FlexBuilder, so these incredibly incomplete starter instructions are for building from the command line.)

First of all, you'll need an XML file that describes the app. Let's call this one Connect4-app.xml and have it refer to my Connect4.swf Flash piece:

XML
<?xml version="1.0" encoding="UTF-8"?> <application xmlns="http://ns.adobe.com/air/application/1.0"> <id>us.beej.Connect4</id> <version>1.0</version> <filename>Connect4</filename> <initialWindow> <content>Connect4.swf</content> <visible>true</visible> <width>520</width> <height>390</height> </initialWindow> </application>

Put it in the same directory as the SWF. Then you can give it a test run in the AIR runtime with this command:

adl Connect4-app.xml

If everything is well-and-good, you'll get your app up in a native window! There you go!

Technically, to build an AIR app, you should use amxmlc instead of plain ol' mxmlc because it points to the AIR libs that give you access to all the system-level functionality you need for a real app. (Like making network connections, reading and writing files, and exiting the app, for example.)

Now, actually building an AIR application to be distributed is a bit of a process that I haven't explored. It involves digitally signing the package; you can get a cert from a CA, or just self-sign your own (though some users might not trust self-signed apps.) The reasoning behind the signature is to provide a level of accountability (you know who wrote the app) and security (you know the app hasn't been tampered with) for the application. This is important, since the app has access to your network and local data, just like any other native application. The signing process doesn't look too bad to go through, and it can be automated in a Makefile once you have your cert.

If you run 64-bit Linux like I do, you're going to run up against all kinds of grief trying to install and run an AIR app, though. Doubly so if you're not running GNOME or KDE, though I hear it's easy to fool AIR into thinking you're running GNOME. Here's some guy's description of how to get things going with 64-bit Ubuntu.

But I'm giving up for the moment—I'll revisit it later. Adobe really should work hard on their well-deserved 64-bit reputation.

If you're running Windows or OS X, or 32-bit Linux with KDE or GNOME, it should be pretty seamless. Just pop over to the Adobe AIR marketplace and grab some free apps. It'll auto-install the runtime if you don't have it already.

More info: Adobe AIR Resources

Share me!

Comments

blog comments powered by Disqus
Blog  ⚡  Email beej@beej.us  ⚡  Home page