SWHX! ...and relax...
So - we've completed our company's switchover to using SWHX - Screenweaver HX, for the uninitiated - and I thought I'd ramble on a bit about why, how, and how it's worked out for us.
Background
I work for a small educational software company in Wales. We produce bilingual CD-ROMs for the home and schools market. Up until three years ago, everything we did was in Director, but at that point I put my foot down and we made the move to Flash.
Why a Flash wrapper?
We've always had a few extra bells-and-whistles on our projects that require more than just a multimedia presentation. Notably configuration, user management and report creation, all of which requires some sort of local-file-system access. We've also always needed things like Windows registry access, because of the way our installers work.
Flash can't do any of those things - so we needed some sort of Flash wrapper or projector that provided that extra functionality.
Attempt 1 : Zinc
So, a short Google search and enquiry on a mailing list later, and we'd bought a license for Multidmedia's Zinc, pretty much the industry standard for Flash wrappers. Lots of features and APIs we could get our hands dirty with. It seemed to work, and we happily went off to create a whole selection of new Flash-based projects wrapped with Zinc projectors.
And a year and a half and about twenty projects later, we found that we were swearing every time we came to publish a project.
Why? Well, here's a few of the more notable issues:
- Poor stability between versions. A new version of Zinc, when released, might introduce new (and useful) functionality. But it would break old functionality that we relied heavily on - and despite us raising the issues time and time again, it might not be fixed for several months.
- Only produced Windows projectors, unless we paid out more money - and although we only create Windows projects at the moment, we're moving to Mac, too, since 95% of our code and assets are cross-platform (being in Flash).
- GUI-driven. We could only generate applications from the (clunky) Zinc GUI, and since we have been moving more and more towards a command-line driven build system, this was a problem. Multidmedia does offer a command-line driven version, but at a premium - and it's only recently become stable.
- Poor integration with Flash, requiring asynchronous callbacks and quite a lot of ugly Actionscript to control.
- Cost. We only had one license! And were unwilling to pay out for more, given the instability and poor support; which meant that only one person (me!) could build the final product. Woe betide everyone if I was on holiday or ill...
Clearly not a great situation. Yes, a lot of that came from the fact that we are a small company, working with a very tight budget. But essentially we'd shelled out for a commercial product which, in the end, we weren't happy with.
However, I'd been watching the haXe mailing list for a while, and Edwin announced SWHX; and having had a read and a play with it I realised that it was a contender. So about a month ago I decided that we'd take the plunge. I started to alter our build environment to use SWHX; to see whether it'd work and whether it would do what we needed. So...
Attempt 2: SWHX
Well, what can I say? It was a very swift transition. There were a couple of features missing. Zinc has far more features than SWHX, but for the most part we don't need them! As for the couple of features we did need which SHWX didn't have...
I wrote them. And added them to one of SWHX's existing extensions (Systools). In each case, it took under a day. And I was able to do so for both Mac and Windows. (And got a nice warm fuzzy feeling from contributing back to an Open Source project.)
And now any developer in the company can check the source code of our latest projects out of the source control system, type a single command-line instruction, and an .exe file will be produced that, when double-clicked, installs a SWHX-powered Flash app on the user's Windows machine. We don't have the Mac support in as yet, but that's looking like under a week's work; because SWHX provides the sources for both.
So, what have been the advantages of the switchover? And why do I like working with SWHX so much?
- Command-line integration. Because building any haXe app can be done from the command-line, there's no more clunky GUI to manually click buttons on.
- Speed. Unlike Zinc, SWHX is very fast to launch, mostly because it's not bloated with functionality that you don't need. If you do need it, you add an extension; and the extensions are all small and load as needed.
- Tight integration. Your Flash app can talk to the SWHX container synchronously, and very, very fast.
- The haXe layer. You can customise your SWHX container using haXe, writing custom functions to do whatever is needed. For example, you can push all your filesystem manipulation code into your SWHX container. Your Flash app can then just issue commands to haXe - 'savePreferences()', for example, and your haXe layer can decide how exactly to do that for whatever platform you're on. This is a difficult thing to describe briefly, but I've found the haXe layer to be immensely powerful and might blog about it seperately. :-)
- Cross-platformness. Okay, a couple of the SWHX extensions are Windows only, but if I want those features on the Mac, too, I'll write them. :-)
- Extensibility and modifiability. Sure, Zinc supports the writing of DLLs; but with SWHX if there's a missing feature or a bug you can make the changes yourself and contribute them back.
- Community (and authors). If there's an issue with haXe, Neko, SWHX or Systools; Nicolas, Lee, Edwin and the others are on hand on the mailing list immediately. Sometimes Nicolas has committed a fix before you've finished reading his email. At the very least, there'll be an answer for you within hours.
- Text file configuration. Because all the sources for a SWHX wrapper application are just ordinary .hx source files, it plays well with a versioning system. It can also be customised by a build system to include version numbers and the like.
- Oh, and, of course, being Open Source, it all costs rather less. :-D
In Conclusion...
So now we have a system that we're all happy with; and can publish any of our products from the source code by typing a line in a console. Sure, much of that is to do with using MTASC, Ant, NSIS and a handful of other utilities, but without SWHX, that chain would be broken.
And we're happy in the knowledge that we can extend SWHX as we need it.
Compared to where we were six months ago, typing 'build' is a joy. :-D
Edited to Add: Just thought I'd mention that all this is quite happily running on Vista as well as XP... we had an issue with haXe's installer, but once past that it all runs fine.



