35+ AIR Examples for JavaScript Developers

You may not have known this, but it was completely possible to author an AIR application with the “Apollo Alpha” using only your favorite HTML editor. No Flash and no Flex required; just you and your HTML. This continues to be the case with the AIR Beta, which improves integration and offers more features. Hot off the presses, the “AIR Pocket Guide for JavaScript Developers” aims to accelerate your success in getting started with this workflow.

I was lucky enough to be able to contribute to this book along side Mike Chambers and Danny Dura. Even after our deadline, I continued to grow my list of cookbook examples – often times based on customer requests. To that end, here are more than thirty-five (35+) source code examples for the AIR developer using JavaScript. Many of these are in the book, while many others are not. Yet others have been refined and updated.

At the time of this post, the complete list of examples is:

  • Read a Text File Synchronously
  • Read a Text File Asynchronously
  • Reading XML Data (using XMLHttpRequest)
  • Writing a Text File
  • Creating a Temporary File
  • Uploading a File in the Background
  • Creating a New Window
  • Creating a New Native Window
  • Creating a Full Screen Window
  • Creating Customized Chrome
  • Adding Custom Window Controls
  • Meebo Window
  • Digg iPhone
  • Selecting a File
  • Selecting Multiple Files
  • Selecting a Directory
  • Connectivity to an HTTP Server
  • Connectivity to a Jabber Server
  • Dragging Text Into an Application
  • Dragging an Image Into an Application
  • Dragging Files Into an Application
  • Dragging From an Application to the Desktop
  • Putting Files on the Clipboard
  • Getting Files from the Clipboard
  • Reading XML Data (using XMLHttpRequest)
  • Connecting to a Database
  • Creating Database Tables
  • Storing Data in a Database
  • Accessing Data in a Database
  • Database Concepts Applied
  • Full Database CRUD
  • Using a JavaScript Encoder
  • Using an ActionScript Encoder
  • Playing a Sound
  • Scaling an Image
  • Determining Image Dimensions
  • MapCache (Yahoo! Maps)

There’s no particular order to these examples, and while some of them do build off a previous example (slightly), they are for the most part what I call “feature-atomic.” That means that if you’re simply looking to solve a particular problem around a specific feature of AIR, then you’ll likely find an example in this list. If there’s something that’s not on this list, then I’d encourage you to leave a comment, or to email me directly.

I can see a future where these are rolled into an “Example Browser” AIR application. You’d be able to install the application, select from a list of examples, and then see the associated code. The application could check a server periodically for updates, and download them as necessary. It’d also make for a great conduit for example requests, ratings and more.

That’s the future though, and for now I’m just happy to see the book hit the market, and to finally release the source code for these examples to the community. The book is also available for free online from Ajaxian as a download in PDF format. For now the book is only available on Amazon. If you’re going to be attending any of the onAIR bus tour events, you’ll also likely be able to score a free printed copy of the book!

What are you waiting for? Download the AIR Beta SDK, crack open your preferred HTML authoring environment (I recommend Dreamweaver CS3 or Aptana), and let us know what you think!

WordPress database error: [Can't open file: 'wp_comments.MYI' (errno: 145)]
SELECT * FROM wp_comments WHERE comment_post_ID = '103' AND comment_approved = '1' ORDER BY comment_date

Leave a Reply