I’ve recently re-published a new version of hexagonlib, a universal AS3 class library at code.google.com/p/hexagonlib/. Some parts that were originally in the library have been removed, in particular the UI components and the game package. This has been done because I’m working on a game engine (more about that one later) that will probably exclusively include these parts. The hexagonlib is instead targeted at a broader area of development, not just games.
Either way, many classes have been updated and improved (and many still need too *ugh*) and what is particularly worth mentioning are the file IO classes which provide a unified way to work with different file formats. Basically the way how files work in hexagonlib is that you can create file objects of any specific file type (like text, binary, image, XML, etc.), give them a path to a physical file and then add them to a loader (BulkLoader, FileLoader, ZipLoader) which then loads the data of the physical files into the file objects.
While you can use the BulkLoader class to load a collection of arbitrary files in one go with all sorts of comfort (priorities, weighted loading, load retries, multi-connections etc.) the newest addition to the library is the ZipLoader class which can be used in AIR development to access a standard zip file using Random Access. What does that mean? It means that you can create a zip file (a very large one if you want), pack all your resource files that can be loaded by your application and then open it with your app and ‘load’ (= extract) files from it without ever needing to load the whole zip file completely into memory. This makes accessing a large zip file very efficient because only the chunk of the requested, zipped file is loaded.
This is especially interesting for us game developers who desire to use large, nicely packed resource files like they are utilized in a similar fashion in most current day commercial games. For a while I was promoting to add such functionality to AIR over at Adobe Labs but that was before I knew that this can actually be done in AIR since 1.0 thanks to the FileStream class and the position property of it (alas, the property is not available in the URLStream class so random access is not possible on web-based Flash). The ZipLoader uses asynchronous loading to open a zip file as well as ‘loading’ files from it because I don’t like the idea of having the application at the mercy of the file system which would be the case with synchronous access (and which is used in way too many examples on the web).
You can download the hexagonlib distribution over at Google Code, which includes the SWCs and documentation and of course the source code is available for access via SVN. I’m updating the library on a irregular basis. There are already some Wiki pages too with code examples showing how to use the BulkLoader and ZipLoader here but I will hopefully get to write some more in-depth tutorials soon.
hexagonlib at Google Code
File API Wiki