FZip Update

We just released an update for FZip (the Actionscript 3 class library to load standard ZIP archives and extract/decompress contained files):

  • Added support for Adobe Air. The Adobe Air runtime provides a low level inflate method, making it possible to load any ZIP archive and decompress compressed files without the need of injecting Adler32 checksums.
  • Added FZipLibrary class for higher level access to files in a ZIP archive. “FZipLibrary processes files (based on file extensions) from an FZip instance and converts them into usable formats. Files can be converted to either a BitmapData or DisplayObject classes. Data embedded in SWF files (like classes) can also be retrieved. Flash’s built-in Loader class is used to convert formats, so the only formats currently supported are ones that Loader supports. As of this writing they are SWF, JPEG, GIF, and PNG.”
  • Bug fix: There was a problem with filenames containing special characters. Filename encoding now defaults to UTF-8. In case the filenames are encoded differently in your ZIP, you can specify the encoding in the FZip constructor.

Special thanks to Daniel Wabyick at Adobe for contributing the Adobe Air support!

Enjoy!

http://codeazur.com.br/lab/fzip/

Adobe Apollo and Last.fm: Proof of concept

I have been toying around with the idea to write an Adobe Apollo application that’s able to monitor your favorite media player (such as Winamp, Windows Media Player, iTunes, Rhythmbox, etc) for play back status and song information.

Last.fm provides an application along with plugins for pretty much all existing media players on all major platforms (Windows, MacOS, Linux, etc) that does exactly that. During installation of the Last.fm client, the user is prompted to install the required plugins for the media players she uses. When a media player executes and plays a song, the plugin establishes a TCP socket connection with the client application and sends status and song infos.

The problem: The Apollo runtime (alpha) that is currently available on Adobe Labs doesn’t provide any documented way of (a) talking to shared libraries, (b) launching executables or (c) serving as a socket server, and Adobe indicated that Apollo likely is not going to support those features in it’s 1.0 release version.

There is hope though. Afaik, the last word on launching executables at runtime from an Apollo app isn’t spoken yet, and there exist some undocumented hacks that enable Apollo apps to do just that. If Adobe should decide against letting apps launch executables, then the only way of solving it is to provide second installers that install a socket server of some sort to do the dirty work.

However, i sat down last night and wrote a proof of concept Flash application that can live in Apollo, which talks to a custom daemon via sockets. The daemon in this proof of concept runs as a Windows Service. I took the Last.fm iTunes plugin and modified a bit so that it also connects to that daemon. The daemon then simply echoes the messages it receives from the Last.fm plugin to the socket listener in Flash. Voilà.

Here’s a screenshot of the app in action (iTunes on top, Flash below):

iTunes talking to Flash

[Update] I also modified the Last.fm Windows Media Player plugin to work with my daemon. All plugins can be used simultaneously. See this screenshot (Windows Media Player on top, Flash below):

Windows Media Player talking to Flash

Note that this is only a proof of concept, and sources aren’t ready for release yet. I would very much like to make this an open source project (The Last.fm plugins are released under GPL), so if there are any interested developers out there who like to help, please contact me or leave a comment. Thanks!

Flashconference 2007, May 4th, Stuttgart, Germany

Just to let you know that i’ll be speaking at the 9th annual Flashconference in Stuttgart, Germany on May 4th. My presentation is about the new Actionscript 3 Flash UI Components that come with Adobe Flash CS3. I’ll give an overview on what’s new, what’s different with respect to previous components sets and Flex, if and how to use them and how to skin and subclass them. I was part of the CS3 components dev team together with the guys at gskinner.com so hopefully i have some interesting things to show. If things work out well i’ll probably also be showing some FC64 stuff i was working on lately.

If you’re in central Europe early May, please drop by. Among others, Mario Klingemann, Andre Michelle, Peter Elst and Marcos Weskamp will be presenting, and as the flashconference is taking place as part of the fmx (“12th International Conference on Animation, Effects, Realtime and Content”, May 1st-4th), there’s almost a full week of top notch events to attend.

Check out the full schedule here.

I’ll stay in Germany for two weeks and will be traveling Munich, Stuttgart and Bremen, so if you like to meet, please drop me a line!

1337! FC64 demo updated.

In celebration of todays release of the Flash Player 9 for Linux beta, i finally updated the demo of FC64, our C64 emulator for Flash Player 9.

Some time ago i implemented support for sprites and the lo-res bitmap mode, so quite some more games work on FC64 now, including Elite (see screenshot below – i added it to the demo), Fort Apocalypse, Frogger, Donkey Kong, and a whole bunch of others.

Also, Voidrunner renders properly now, including the sprites in its intro.

Check it out:
http://codeazur.com.br/stuff/fc64_final/

FC64 wins Flashforward Film Festival

Darron already blogged it: FC64 won Flashforward Film Festival in the Technical Merit category. Ohhh yeah!

I promised i show you the FC64 trailer that was shown at the ceremony, so here it is:

http://codeazur.com.br/stuff/fc64_final/flashforward/

(takes a while to load, i didn’t bother writing a preloader)

The fun part of it is that the trailer is written in 6502 assembly and executed by FC64. Even more fun: FC64 loads the assembly sourcecode at runtime, compiles and executes it. The scrolling arrows are actually lots of custom 8×8 pixel characters, animated by the C64 graphic chips smooth scrolling feature. I used raster interrupts to switch scrolling off in the middle part where the text appears (we don’t want that to scroll).

Ok, i also cheated a bit. Credits go to Andre Michelle: i ripped the Super Mario mod off his fantastic mod player. SID emulation in FC64 is being experimented with at the moment by Martin Wood and Ralph Hauwert, but we don’t have anything stable to show yet. Be patient :)

ZIP it up!

Did you ever write an image gallery or a game in Flash? Did it bother you to write rather complicated load queues to load lots of small files such as image thumbnails or game assets like tiles? Are you working with big text files and need a reliable way to compress/uncompress them to save valuable bandwidth?

I’m proud to announce FZip, a cute little Actionscript 3 class i’ve been working on together with Max Herkender that enables you to load standard ZIP archives and extract contained files while the archive is still loading.

FZip is released under OSI approved zlib/libpng license.

Sample usage:

public function YourApp() {
   var request:URLRequest = new URLRequest("your.zip");
   var zip:FZip = new FZip();
   zip.addEventListener(FZipEvent.FILE_LOADED, fileCompleteHandler);
   zip.load(request);
}

private function fileCompleteHandler(evt:FZipEvent):void {
   var file:FZipFile = evt.file;
   trace("File loaded: " + file.filename)
   trace("  " + file.sizeCompressed);
   trace("  " + file.sizeUncompressed);
}

Check it out: FZip at côdeazur brasil lab

Bratwurst

Adobe Flex 2 Language Reference, class Class:

For example, if you are using an MXML compiler to generate SWF files, you would create an embedded class as follows:

[Embed(source="bratwurst.jpg")]
public var imgClass:Class;

Real Coders do Assembly

So our Flash Commodore 64 emulator project, FC64, got nominated for the Flashforward Film Festival recently (read my previous post). The 60 finalists are given the opportunity to submit a 45 second trailer showcasing the work, that will be shown live in front of 1000 people at the ceremony.

I won’t spoil it so i won’t show the trailer here (you gotta wait until after the Flash Film Festival ceremony or better yet attend it to see it). What i can do though is – in the spirit of open source – show you the source code:

http://codeazur.com.br/stuff/fc64trailersource.asm

The trailer is written in 6502 assembly and runs in FC64 – a real ‘Demo’. It actually should run as is in the original C64 hardware, and in any other C64 emulator. If i ever find the time, i’m going to prepare a binary image to load it into other emulators.

By the way, FC64 features an assembler (the souce code above is loaded and compiled at runtime into the emulator), as well as a disassembler and debugger. This is currently not reflected in the emulator UI and undocumented. Plans are to make the UI a full featured IDE for developing stuff for the C64.

I had hell of a fun coding the trailer demo, and it put me right back in the mid 80es when i used to waste night after night coding on my beloved bread box. Ahhh, memories.. :)

Back to AS3 development now, listening to Depeche Modes ‘See You’. Ha :)