flash tutorial

Brevity in conditionals

I see a lot of constructs in code that are just wordier than they need to be. All of these examples are in ActionScript 3, though most of them apply in other languages as well.

Many of these are also marginally faster than their wordier counterpart.

Making friends with binary representation

This post is inspired by Nick’s aversion to bitwise operators all over the place. Despite this glaring personality flaw, he’s still worth hiring.

Many developers, and unfortunately almost every Flash developer, are far too comfortable with their abstract data types like double and int that they forget that, under the hood, everything’s stored as binary numbers. Having just a little knowledge about how things work under the hood makes you write better, faster, cleaner code.

Laid-back file loading in AS3

This post is in response to Nate, who asked me this question a few days ago.

If you load a file using AS3, there are a couple of potential outcomes —

  1. The file exists, you have permissions to access it, and it completes successfully! Hurray! The URLLoader dispatches an Event.COMPLETE.
  2. The file exists, but you don’t have permissions — the URLLoader dispatches a SecurityErrorEvent.SECURITY_ERROR.
  3. The file doesn’t exist, or you otherwise can’t access it — the URLLoader dispatches an IOErrorEvent.IO_ERROR.
Syndicate content