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!

4 thoughts on “My empire for a NullPointerException – reasons ActionScript sucks”

  1. Since you were programming a game rather than a biz app you forgot some:

    * No support for bubbling mouse events without writing your own handlers (this is inexcusable).
    * Horrible Z-layer handling routines.
    * Too many reserved keywords (seems like half the dictionary is reserved).
    * Giant, buggy components.
    * Poor compiler errors (you got part of this one) and buggy/non-existent debugging mechanisms.
    * Lack of support:
    – Adobe censors useful questions/comments in online help.
    – For some reason Adobe support forums aren’t indexed by Google.
    – I don’t even know if there IS an option to buy ActionScript phone support.
    – Upgrade policies are weird: owning Flash 8 Pro or Studio doesn’t qualify you for an upgrade to Flex 2.

  2. Flash 8 pro is for designers, not develeopers. There is a strong divide in the Flash product range between designers and develepors. There is no reason why they should offer the upgrade to Flex2 as to them it is not an upgrade, it is a completely different source of income. There are clients who love the frilly stuff and will pay a lot of money for it, and there are clients who want an application. So really it’s down to developer masochism and persitence to get things which should be simple out but end up frustrating. Persistence is an excellent trait in a developer but it is wasted on this sort of stuff.

    Developing in Flash pro 8 as a code IDE is only recommendeed by “Designers who do if statements” ;). Someone please form a band with that name. It has an 80’s panache to it. Lots of hairspray would be a necessity. I have got designers that far. Now the elseif’s are the hard part.

    If you look around for criticisms you’ll find references to even macromedia won’t code in it.

    Yes you can do something intellectually fantastic with flash pro but you have to deal with things in this modern age you should not have to deal with like no detection of syntax errors before compilation and the infamous “You called something that doesn’t exist yet but It may do later so I won’t scare you with any notification errors”. It’s the whole nurture the stupid and hinder the gifted thing which has beeen in it since birth. Designers love it, developers who don’t know better can live with it. Unless you use better tools for coding in other languages you really don’t know any better. Saccharine probably tastes like sugar before you have sugar.

    Also there is only so much typing someone can do before they get RSI/arthritis. There is an internal keystoke counter. Do people really want to be saying at 50 “I bet I could still type if only Macromedia had ever deemed intellisense important enough fo us code monkeys in flash pro instead of making the bouncy ball effect easy and clicky clicky?”

    Flex 2 seems pretty nice, it seems to be finally getting to the party half a decade later but in a pretty nice gown. But until there is a widespread adoption of flash 9 it is pretty NullPointerException in itself. At least Adobe plan to assault it on everyone in Acroread and stuff so hopefully I don’t have to wait over a year to start implementing Actionscript 3 via client approval.

  3. Agreed. It’s actually quite funny that although they’re very similar at the first glance, C++ and Actionscript are two different worlds. For C++ veterans AS offers what would seem to be incredible freedom, coupled with dozens of hacks and quick fixes – but at the same time restrictive of many very practical and useful features.

    An example would be the inability to include plain functions in code other than the main timeline. I tried hard to understand why would anyone think you wouln’t reuse loose functions – after all, say that you wrote a dozen functions to add to the missing functionality of the string class (which is, in every imaginable aspect, inferior to the STD implementation), you wrote them to *use* them, right? Apparently you can’t, as everything you reuse must be an object.

    Or another example – the “freedom” of AS leads to nasty, sloppy coding, and such hacks like the Delegate class.

    AS is perfect for code no longer than one page – after that, it just starts to get messy, incredibly slow or for some random reason broken.

Comments are closed.