AS3 has two ways you can typecast a variable. These ways are not equivalent. Let’s take a look at how they differ:
Everything’s a Function
The function call operator () is one of the most straightforward, well-understood, and universal operators in all of programming. Let’s see how AS3 can butcher it:
Details of toString()
When an object is converted to a String, it is first checked for a toString() method. But there are subtleties to this that you may not have considered.
The Type-Safety of Vectors
I really want to like Vectors, the new typed array functionality in Flash 10. In fact, I use it as often as I can. But there are some really awkward things about it that make it a pain. Here are some gotchas:
Spot The Problem
You could probably do this in most languages and it might be hard to spot. See for yourself.
Null and Undefined
Usually languages just have one way to specify “no value”. Call it null or nil or whatever you’d like, but AS3 and JavaScript have two: null and undefined. Here’s a little bit to help you understand when and why you’ll come across the two as well as some tricky differences between them.
The Magic of is
By now you’ve certainly heard of the is operator in AS3. It’s the replacement for instanceof in AS2. But the two are not the same! Don’t make this mistake…
The Truth of Strings
What strings are true? The answer may surprise you.
Fancy Or
The lowly || operator in the hands of AS3 and JavaScript is not so lowly. Here’s a quick time saver.
Triple Equals
Anyone coming from a language like C that doesn’t have a === operator seems shocked when they encounter such a ludicrous operator. For them, and for anyone being a bit careless, simple usage of === can really bite you.