Flash And Compressed Data
Sat, 2011-09-10 22:13 — steve.mcdonald
I've had a plan for a while now to create a fun set of tools that allow people with photo editing skills the ability to create fun engaging stories that play music and animate pictures. The one thing holding me back for a while now was the delivery mechanism. I have been imagining that I could create the desktop application to author the stories and I could create a player for Android and iPhone tablets so people can experience the stories, but the glitch for me was in the question, "How do I allow people to package up a story, which would likely be a combination of MP3 files and picture files and a text file containing animation instructions, in way that is very portable?" I can imagine people will be emailing around a bunch of pictures and documents and MP3 files, right?
Well, I solved that one today too (you may have read my other blog that explained how I figured out some other technology early this morning). The best way to package up a bunch of files would be in a ZIP file. A ZIP file is not only a single file containing other files, but it also has the benefit of making the files smaller, which speeds up delivery. You might think this is a bit "Captain Obvious" of me, as if I just discovered ZIP files. What I can tell you is that I just discovered how to uncompress, in memory, ZIP files using Flash ActionScript 3 which allows me to open a single ZIP file but gain access to images and audio and XML data files programmatically.
This is kind of exciting. I know a number of people over the years who have been interested in a similar technique for the delivery of multiple related files. I may open source my wrapper once I handle a few more necessary tricks.
So, how did I do this? Not unlike my morning discovery, I found an extremely simple open-source library written in ActionScript 3 that allows me to create and read compressed files. So I fiddled with the code until I had written a wrapper class that allows me to pass it the name of a compressed file (i.e. "story.zip" ) and once it is ready it hands the project an ARRAY of assets ready for display straight from the ZIP file.
I am pretty excited. Most of the other tricks I need to know to make this app, I have already tested. It is a matter of putting the idea together now, which is fairly exciting.
Not bad for a guy who is recovering from a week long cold and slept the majority of the day in front of the US Open tennis tournament!
