Thoughts on SWX, Flash and Hacking Code

Let me state first off that I haven’t yet had a chance to play with SWX yet. However I was at LFPUG when Aral gave his talk and announced his ‘new born baby’, and I have to say I sat with a broad smile and a warm feeling inside as Aral presented and finally demonstrated SWX. You see it really did seem to hark back to a more innocent by gone era from of flash. Back to when people saw a perceived problem and attacked it with the tools and techniques they had to hand.

Aral himself voiced his concern over the loss of ‘go at it’ attitude within flash development as it has evolved. In part due to the ‘rule of the rod’ attitude of insisting on Frameworks, Patterns, and Object Oriented development practices. It was truly refreshing to see a developer express sheer glee at returning to a hex editor to decipher the .SWF format with one single goal in mind.

Reading some of the responses to this project has also bought a smile to my face. This time not for particularly good reasons. Its plain to see there seems to be some issue with the ‘raw’ approach that Aral has taken to accomplish his goal. Some quotes that stick out for me revolve around the ‘Hacky’ nature of the solution Aral has produced. The use of onEnterFrame as a polling device, or the use of loadMovie as a transfer system. But why should this be a problem? Aren’t they there to be used?

The current ActionScript 2 standard is where it is now as a result of just such work arounds and hacks. Thank you very much. Dig deep enough into some of the ActionScript 2 classes and you will find not only hacks like this, but in some cases, what you might consider worse ones. In mx.Transitions package for example we find the OnEnterFrameBeacon a class that not only makes use of onEnterFrame, but also a MovieClip that is created to a ‘Magic Number’ based depth? There are I am sure any number of other examples.

Flash is where it is today to any number of early flash developers working with very limited action script and coming up with work arounds and hacks to get it to accomplish the myriads of solutions we are now fortunate enough to be able to develop now. Remember ‘jump movies’ or __proto__ or storing sine tables to do 3d? Before PaperVision. No amount of Java development sensibility is going to change that to quickly.

Even with all this wonderful ActionScript 2 Object Oriented (?) loveliness, developers every day are finding they have to go back to the oldskool to get there applications to work. Flash hacks still have a huge level of relevance today, for the simple reason people are still finding things they want to do in flash that they cant do any other way. Flash Lite, Accessibility and Localization are some pretty good starters that still require copious amounts of hacking at times.

5 thoughts on “Thoughts on SWX, Flash and Hacking Code”

  1. Amen!
    The days of beating back the briars in ActionScript with f*cking sticks and pushing our way through seem to have been forgotten. The world of Flash came from creative folk who dared to hack and not listen to the naysayers from the “Enterprise” world. Now those folk are leading the way..
    Run, run I say and find your own SWX to hack away at.
    Long live __proto__! 😉

  2. Yeah, and if we need further examples: if we look to adobe, microsoft, and apple software i’m sure they are using hacks in their programming languages. Framworks and patterns are there to be used to help us-not create a oppressive religion where any other solution is shouted down. Can someone tell me what the definition of “hacky” is anyway? One man’s hack is another man’s solution….

  3. Hacking away at something because there isn’t a good alternative is obviously valid, but hacking away when there is a perfectly useable solution available is maybe a bit of a waste of time?

    My problem with using things like ‘loadMovie’ to load data is that it is not descriptive. I wouldn’t write a method called ‘moveLeft’ that made something fade out, as if we all went about this none of the code would make sense at all.

    That said Aral’s done a great job and SWX is really taking off in the FlashLite community where its really needed.

  4. @Tink:

    Unfortunately, the current crop of RPC offerings are not very usable. There’s something inherently unusable about Flash Remoting support that changes/breaks with every version of Flash for example and makes people search through Adobe’s website to find and install Remoting classes before they can even work with it. (And, due to the EULA, no one can redistribute these classes in a simpler way — SWX, on the other hand is open and faces no such restrictions.)

    Simplicity is a very important feature.

    And, most importantly, SWX is native. It’s the native data format for Flash.

    (And, the current reference implementation of SWX RPC works the same way on Flash 6, 7, 8 and Flash Lite 2.0 and 2.1) 🙂

    The fact that the method used to load SWF files in Flash is called loadMovie() doesn’t mean that you can’t make it more descriptive in your own code. In its simplest form:

    function loadData(url, encoding)
    {
    // create a movie clip, etc…
    myDataHolder.loadMovie(url, encoding);
    }

    If you want to work close to the metal, you can use loadMovie() and create your own APIs, etc. Otherwise, SWX AS (the ActionScript library for SWX RPC) gives you a completely abstract interface for doing RPC calls that’s very intuitive and descriptive 🙂

    SWX RPC is definitely very important for Flash Lite development (as there is no other RPC solution on that platform; Flash Remoting does not work in Flash Lite) but SWX RPC has applications for the web (especially mashups with the provided SWX APIs for Flickr, Twitter, etc.) and beyond (see Folkerts AIR application that uses SWX.)

    To learn more about the current state of SWX, please see my recent blog post titled What is SWX, how does it work, and where is it going?.

  5. I can’t help but feel that there’s much more fun to be had in playing the game, experimenting, making mistakes even, than sitting, easily-hidden in the crowd, criticising, and nay-saying. Life would thus be a lot more serious and even less-inspiring if all observers were of this nature. You can sit and observe all you like, but if you’re not happy with what’s being made, i’m sure you have the skills to do something about it?? I would gladly pay to see that happen…

Leave a Reply

Your email address will not be published. Required fields are marked *