JavaScript AIR Samples Updated

Adobe AIR continues to march forward, and at MAX 2007 AIR Beta 2 was released. To accompany this release came new versions of tooling to include Flash CS3, Flex Builder 3 Beta 2, Dreamweaver CS3 (including a new version of Spry), and Aptana’s AIR plug-in. Part of the requirement for the Aptana team was a Beta 2 set of JavaScript-based AIR samples. My Beta 1 samples shipped with the previous version, and I’ve updated those samples for Beta 2.

The Beta 2 version of the samples have been shipping with the Aptana AIR plug-in since MAX, but you can now also download them separately.

These samples have been a labor of love. I originally created them for the JavaScript AIR Pocket Guide, and although dated, is still a good reference, and is publicly available in PDF format (for free). I added to them based on my own playing around, and then shared them with the public via my blog, and the Aptana team directly. Driven largely by customer questions on the AIR forums, and one-on-one meetings, there are now almost 45 samples, including more full applications.

Revisiting 35+ samples for Beta 2 required a substantial amount of focus and time. As the next release of AIR hits the stands, I’m sure I’ll be required to find the time to update them once more. The good news is that I’m working on an easier way to share the samples, and allow for the community to get involved. I envision a place in the near future where you can add your own samples, comment on existing samples, and even rate them. Stay tuned!

In the meantime, here’s the list of samples:

  • 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
  • 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
  • Extracting EXIF Thumbnail
  • MapCache (Yahoo! Maps)
  • Flash Filters (Script Bridge)
  • Stopwatch (Using Flash Assets from JavaScript)
  • Flash Remoting (Script Bridge)
  • Encrypted Local Store
  • Video Player (Flash Over HTML)

10 Responses to “JavaScript AIR Samples Updated”

  1. Peter Says:

    Great stuff Kevin.

    Cheers

  2. Peter J S » Javascript AIR Samples Says:

    [...] http://blog.kevinhoyt.org/2007/10/25/javascript-air-samples-updated/ [...]

  3. Matt Graf Says:

    I am trying to connect to a SQLite database that I created and I am getting this error:
    event.error.code: cannotOpen

    event.error.message: Unable to open the database file.
    and here is the air code
    var dbFile = air.File.applicationStorageDirectory.resolvePath(”c:\DBSample.db”);

    conn.open(dbFile);

  4. Kevin Hoyt Says:

    Matt,

    You generally don’t want to refer to “C:\” when building an AIR application because you shouldn’t assume that you’ll be running on Windows. If you have the file in the root, you should look into using air.File.rootDirectory.resolvePath( ‘DBSample.db’ ).

    That being said, there isn’t enough code provided to be sure about the problem. How (or with what tool) was the DB file created? Not all tools create the same version of SQLite database files. I use SQLite Database Browser which is an open source, cross-platform, lightweight tool. Also, in some cases, since SQLite is file-based, if some other tool or process has a lock on that file, AIR may not be able to access it. If those tips don’t work, send me your code and I’ll take a look (khoyt _at_ adobe [dot] com).

    Thanks for reading!
    Kevin

  5. steve lee Says:

    hey, Kevin, great job!

    Cheers

  6. Venturi Says:

    it’s time to update, i’m using beta1 :)

  7. Tom Says:

    Great information and tips here!

  8. Mondo Libero Says:

    Good sample, thanks for this site and for your work.

  9. Simon G. Says:

    Thanks for the update, really very good job kevin, i appreciate this!

    Simon G.

  10. jueogos Says:

    Great job.

Leave a Reply