wiidiaplayer technology: MTASC / HaXe

August 28, 2007

For the Wiidiaplayer, the technology choice was not that hard. I looked for a tiny-tiny-tiny while at building my own video player in javascript, but discarded this option almost immediately, flash was the way to go. Obviously there was still a choice on how much of the application should be flash (and the rest HTML/javascript I guess), but flash would always be a component.

My experinces with flash had never been extremely positive. In the Old Days of flash 6 I just didn’t get it. I could do the flash tutorial in the IDE 10 times, and still I didn’t get it. True, I could create a simple flash animation, but no, I wasn’t sure what I was doing. It was the same feeling I had using Word for the first time (having only used the alt-F3 code screen of WordPerfect before); it was the feeling I has when using Frontpage in design mode: The computer did a lot of stuff for me, and most did what I wanted, but the part that didn’t work as I needed it too, well, I didn’t have a clue why… I want to see lines of code, and I want to be sure that nothing exists except those lines of code!

Flash 7 and 8 actually made stuff a little easier for the programmer. Less designing was needed, and more programming could be used. Movieclips (but not library objects) could be created from code. This code, however, could live on a couple of hundred levels (each movieclip could have its own code, and handlers, and each object had handlers of its own, so sometimes you would spend hours figuring out why something would work in some way, only to find some old code still deep in your object structure.

One can imagine my relieve on encountering (the beta of) Flex 2 some years ago. For the first time (as far as I was concerned), code based flash programming was possible, and it seemed that finally I would be able to write a decent, extendable, reusable, flash movie, and it used eclipse, so I could use all my favorite key bindings in flash-editing. And, although it seemed like Adobe wanted everyone to buy the whole Flex-server package, the Flex IDE could be bought separately, for a price that was still “acceptable” to the individual. Still, there was one big flaw, it would be Flash 9 (Flash 8.5 then) only, and acceptance of a new flash version into the 90-95% range still takes years. Unfortunately, for this reason, I’ve not done any serious projects in Flex Builder 2 yet.

The Wiidiaplayer should run on the Wii, so should be flash 7 (or less). Flex would not be an option here. I had more or less decided to build the better part of the Wiidiaplayer in flash, and I dreaded having to do this in the flash IDE. I did build my proof-of-concept in the IDE, but decided I would start looking for alternatives.

The two serious alternatives that I could find are MTASC and HaXe; MTASC compiles actionscript files ito an existing swf file. This file should contain the library for the movie. Since the library typically only changes once or twice during the project, one could create the library in the flash IDE, and then develop in eclipse, and compile with MTASC. Yet a step further is the possibility to first compile the swf file and library out of thin air (ok, a very small XML file), using swfmill. MTASC only compiles up to ActionScript 2 files; anyone having the need to handle AS3 is directed to the successor of MTASC: HaXe.

HaXe seems to be a very ambitious project. HaXe is a programming language; programs in the language can be compiled to run serverside (though the neko virtual machine), run in the browser (it is rewritten to JavaScript), or compiled to an swf-flash file. In includes easy methods so that client-server communication is streamlined. The language is ECMA-script, so it’s really close to ActionScript, but not quite equal.

The idea to have one language that runs both on the server and on the client is compelling. In my work we recently find ourselves writing some algorithm both in PHP and in javascript. In addition, I really like the ECMA-script language, and would like to do my serverside programming in it as well. Finally, I was really surprised by the stability the language seemed to have: I only did a few tests, but it seemed to be stable, and deliver what it promised! However, the language is still very new. Resources on it on the internet are scarce, and it might well still contain bugs. There was especially little documentation on how to use it to produce flash 7 files; However, the most important reason for me not to use it, is it’s incompatibility. The MTASC homepage used to contain a section on why to use MTASC. One of the reasons was that, since it compiled normal ActionScript, switching back and forth between the flash IDE and MTASC was easy. Interestingly does the same site now promote HaXe as the way to the future. The first thing I needed (as with any large flash project) was a good logging system; Luckily the internet contains thousands, all free, and all written in ActionScript, none compatible with HaXe…..
So, for the past couple of weeks I’ve been developing using MTASC, the MTASC eclipse plugin, and swfmill, and I think I finally get Flash 🙂 .

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: