My empire for a NullPointerException – reasons ActionScript sucks

I’ve just finished coding two kids games in Flash called “BarryBell” and “DrumBell” (I will make them available here soon). ActionScript is a cool language: it has all the things you would expect from a real programming language, it is compiled, supports strong typing, classes and inheritance, interfaces, static variables, and constants. However, there are some things that suck.

The following is a list of things I think suck about Flash Professional (in order of most suckful!):

  • no null pointer exceptions – I can reference properties and variables that don’t exists and Flash does not care! this is highly irritating when you make a spelling mistake as Flash will not inform you of the error. The only way around it seems to be to use a decent IDE that actually does strict checking of existing classes, their public properties (if any), and member functions.
  • Event Dispatcher class – the included event dispatcher class lacks the option to provide a member function to call back when an event is fired.
  • No generic Event class – of course you can write your own, but a standardised one would save you having to look through Macromedia’s EventDispatcher class to work how the event broadcaster actually works!
  • Delegate class – really, why does this even exists! Plus the lack of support to bundle an argument is highly irritating.
  • no ability to send arguments when instantiating a movie clip – that is pretty severe.
  • Phoney-baloney iterators – calling the for (i in someHashMapObject) returns i as an integer instead of the object. What is that all about?!

If I get a chance, I will write another entry describing these problems in more details. All I can say is, if you are going to copy Java’s Event broadcasting model, do it completely as it is not that hard. There is hope yet, as all the core classes are open, you can simply re-code them to do what you need.

Mozilla, heed to the flaws of Adobe Flash and lets us avoid this in JavaScript 2.0!