AOL Embraces Flash with AIM Express

This morning the folks over at AOL, and more specifically the AIM team, launched version 7 of AIM Express. And guess what, it is built using Flash! It really is a great experience and a quality example of the power of ActionScript 3.

What is most interesting to me though is not the client, but the API that they have made available to ActionScript developers. You can go to Google Code and actually use the same base AIM AS3 library to build your own client or integrate AIM functionality into your application! If you know anything about my history with the AIM client and Central, you will know how excited I am about this.

When it comes to building applications that have chat, presence, or some type of collaborative functionality, you have to consider the infrastructure it might take to get up and running. With this library, all you have to do is build your client, and let the user utilize their existing AIM/ICQ account! And guess what, I am sure most of them already have one of those…

Saving Encrypted Data in AIR

Have you ever wanted to store a users password, you know, that little checkbox that says ‘Save Password’ on any login form. Or maybe you just want to persist a session token or other information. You could use the Local Shared Objects or even the File API, but that isn’t very secure. How do you store sensitive information that your AIR application needs to persist?

Luckily, there is an often overlooked API for just this use case. It is called the EncryptedLocalStore and is actually quite simple to use. The EncryptedLocalStore API persists data to the local system using a name-value pair scheme that is specific to each application. The name is a simple string, and the data is a ByteArray. The data is stored using both the application ID and the user information from the local system, so other AIR applications and other users cannot access the data. This API is actually hooking into the Keychain functionality on Mac and DPAPI on Windows. The data is encrypted using AES-CBC 128-bit encryption. So the main point to take away is that the data is very secure and other AIR apps or users will not be able to easily access it.

So, how do you actually use the API? Well, lets assume that we have a session ID that is a string and we want to persist in the EncryptedLocalStore. Lets also assume that the session ID is stored in a variable called ‘sessionId’. One thing to keep note of is that the data must be stored as a ByteArray, so we first need to create a ByteArray instance and add the string value to it. The code might look something like this:

[as]
var bytes:ByteArray = new ByteArray();
bytes.writeUTFBytes( sessionId );
EncryptedLocalStore.setItem( “sessionId”, bytes );
[/as]

To retrieve the data, you simple retrieve the ByteArray using the getItem API, and then read your UTF string value out of that ByteArray:

[as]
var sessionIdBytes:ByteArray = EncryptedLocalStore.getItem(“sessionId”);
var sessionId:String = sessionIdBytes.readUTFBytes( sessionIdBytes.length);
[/as]

To remove an item from the store, you simply call the removeItem API:

[as]
EncryptedLocalStore.removeItem(“firstName”);
[/as]

There are a few things to note when using the EncryptedLocalStore API. First, the API is syncronous and is geared towards small amounts of data. While there is no practical limit, any ByteArrays larger than 10MB might cause performance issues. Second, when debugging your application using ADL, we are actually using a different store than what is being used for installed applications. And last, when uninstalling an AIR application, the data in the EncryptedLocalStore is NOT deleted.

One last note as well, this API is available to both Ajax and Flash based AIR applications, like all ActionScript APIs.

AIR Tips and Tricks – Video, Slides, and Code

For the past few months the crew here at Adobe, along with a few other brave adventurers, spent a total of more than four weeks traveling throughout Europe educating developers in many countries on AIR. My presentation for that trip was called ‘AIR Tips and Tricks’. Below I have included a ZIP file of all the source code for those presentations along with a PDF of the slides. Mike Chambers has also posted a video of the presentation as well, which was recorded in Munich.

Free Flex, Flash and AIR Books

Recently I was lucky enough to participate in the authoring of a book on JavaScript development in AIR with Mike Chambers, Kevin Hoyt, and Dragos Georgita. What has been great about this book is how well it has been received by the community and the fact that you could download a PDF copy of it for free (you can still purchase a hard copy as well at Amazon). What wasn’t great, was that it was only in English.

Over the past few months, Mike Chambers has been working on a solution to this problem, and what he has come up with is going to be an amazing resource. The site is called toString.org and encourages developers to submit translations to the site for publishing. Mike describes the site as:

…a site that hosts books about Rich Internet Applications, with a focus on book that leverage the Adobe RIA Technology Platform (Adobe Flash Player, Adobe AIR, Adobe Flex).

Currently there are two books on the site, both the Flex and the JavaScript pocketguides for AIR development. There are already a few translations as well. Mike is not done with the site yet as well and says that many new features are coming soon, including offline support through an AIR application, REST APIs, and diffing capability for reviewing changes between updates.

The Official Google Maps Flash API

For a few years now, I have been waiting for this: an official Google Maps Flash API (based on ActionScript 3). You heard it right, instead of using one of the many other solutions which tapped into the tiling servers of the various mapping providers, this is the real deal. And on the surface it looks great.

Google Maps Demo

It is also interesting to hear the Google Maps team talk about Flash on their blog, and discuss why they chose to do this project. In the post they maintain that performance is a big part of it, and that with Flash, the smoothness and speed of the mapping component are much better. From just playing with the demo they put together on their blog, I agree. The tiles load very quickly and the transitions are very smooth. It also integrates video very nicely. Obviously this isn’t to say that the current Ajax implementation is bad, but the Flash version definitely gives the map that little extra polish.

It is great to see Google realizing the benefits of the Flash platform. (I think they got bitten by the bug when they started Street View.) If you are hoping to see more from them, please show your support for this project and download the SDK and start playing with maps in Flash today.

Google OpenSocial ActionScript Library

There definitely has been a bunch of buzz about Google’s OpenSocial initiative in the past few days. I have always been intrigued by social networking and was hoping that one day somebody would create a central repository for this kind of information. I get tired of adding all my friends to different social apps every time I sign up for one. It appears from the outset that Google is trying to fix that, and I believe nobody is in a better position to do just that than they are.

Today they released the documentation on their API. It looks like right now they do not have an ActionScript version of it available on the site. I intend to fix that. I have created a Google Code project at http://code.google.com/p/as3opensociallib/. I have not committed any files just yet but intend to start on this project right away so I can play with the API a bit and get to know it. If you would like to contribute to this project or just keep an eye on it to see when it is available, keep checking the Google Code project or this weblog.

Apollo Native File Dialogs

Currently the Apollo Alpha doesn’t support native file dialog boxes (it will before the final official release.) Despite that, there is a way to get this functionality now by using existing Flash Player APIs.

I will first show how to display a file ‘Save’ dialog box which allows the user to specify the name of the file they would like to write to the disk. This will allow them to type in the name of a file that may not exist. The user can also select a file that already exists and the dialog will prompt the user that they are about to replace that file on the system.

To accomplish this in Apollo, you use the ‘download’ method on the flash.net.FileReference class. Because the flash.filesystem.File class extends FileReference, you can employ this technique by using that class as well. The trick to getting the File reference without actually downloading the file is to cancel the URLRequest before it executes. See the code below for an example:
Continue reading “Apollo Native File Dialogs”

New AS3 XMPP Library on Adobe Labs

Almost a year ago I began working on an XMPP library using ActionScript 3. XMPP is a protocol which enables real-time collaboration and presence information to be communicated between clients. (For more information about XMPP see http://www.xmpp.org.) With the new Socket API in Flash Player 9, writing a formal XMPP protocol library in ActionScript was much easier than it was in previous versions of the player and showcased some of the new features of the ActionScript 3 language. I decided to start to write one from scratch.

I have submitted this library to the Adobe Labs repository. You can browse the repository using the link below. The path to the source is ‘projects/xmpp’ in the ‘flashplatform’ repository. Christian Cantrell has also made a great post on his blog that describes how to checkout the latest code here.

Over the past year I have made many optimizations and feature additions to the code base and I am still actively developing the library. If you have any suggestions, questions, or patches related to this library, please feel free to email me directly (ddura@adobe.com).

  • Browse the source here.
  • Download the latest nightly drop of source from the Adobe Labs repository here. (This contains the entire labs source tree.)

Update: The code for this library has been moved to Google Code, where some bug fixes and changes have occured. Be sure to update to that version. Link