Xdrive AS3 Library

I have not posted in a long long while it seems. That would be nice if I were just hanging out on a beach some place. However, I have been busy doing lots of things for work and working on a new AS3 library.

I have been developing for the past few months an AS3 library (as3xdrivelib) wrapper for the Open Xdrive JSON API. Xdrive is an online storage platform and they offer a free JSON API for developers to create storage and other types of applications upon their service. With Xdrive, each user gets a 5GB account for free, with additional costs for more storage.

I finally got around to making an AS3 library that wraps much of the Xdrive API and abstracts the inner workings from those developing Flex, AIR, or Flash applications. The Xdrive API is extremely rich, it offers ways for users to share folders, collaborate on shared collections (look for a later post and application on this feature), and publish assets. However, main part of the platform is file management.

I have placed the library on Google Coders and included a Flex sample application for doing some basic operations with Xdrive. You just need an Xdrive account to start using the library. I am hoping this helps developers starts to build some cool applications using the Xdrive plaform. Along with the library, I included an example application called Xdrive SlimDrive, which demonstrates the basic functionality for doing file management and shows how to work with the library.

===============
as3xdrivelib
===============

The as3xdrivelib project is a wrapper for the Open Xdrive JSON API. It provides much of the client-side functionality for applications; for example, authentication, uploading files, sharing files, and basic file management.

Project Page: http://code.google.com/p/as3xdrivelib
Project Group: http://groups.google.com/group/as3xdrivelib

Authors: Michael Ritchie, Maria Vazquez, Lucas McGregor, Joe Provost
Dependencies: corelib (http://code.google.com/p/as3corelib)

How to use the as3xdrivelib with Cairngorm.

I didn’t get a chance to post this to the Google Code, but I wanted to show a quick login example that uses the library with Cairngorm. The following example uses a very simplistic login screen with a Cairngorm Event/Command/Delegate to login to a users Xdrive account. The example is pretty straight forward if you know Cairngorm already. There are some things to notice in the Delegate and Command. In the Delegate, notice how the I setup the delegate to use the as3xdrivelib as a service and how I mapped the events back to the command.

[as]
public function login(user:User) : void {
var token : XdriveAPIToken = service.login(user);
token.addEventListener(XdriveAPIEvent.API_RESULT, responder.result);
token.addEventListener(XdriveAPIEvent.API_FAILURE, responder.fault);
}
[/as]

In the Command notice how I map the payload (user) on the API result to the Model. This is explained in the documentation for the library, but basically the payload contains a return variable(s) name on the payload event that almost always represents the object you send to the library method.

[as]

public function result( event : Object ) : void
{
var resultEvent : XdriveAPIEvent = XdriveAPIEvent(event);
model.user = resultEvent.payload.user as User; // store value in model for binding
}
[/as]

Example File (right-click to view source/download)

Update

AOL killed Xdrive and so the API is also dead, code still available but its not defunct and won’t work with Xdrive. Thanks AOL for killing yet another good product.

– Mister