Many classes in AS3 are dynamic, meaning that you can add and remove their fields at runtime. This is powerful, but extraordinarily slow. This series will cover some common ways you might be inadvertently using dynamic access or using it too much. This will help you make your code faster. In the first installation of the series, I’m going to talk about the simple act of indexing an array or vector.
Posts Tagged operator
We’ve all seen it, perhaps even in our own code. It’s something I think we do because we’re not really sure what would happen if we didn’t do it. Here are some little tidbits of pointless code I’ve been seeing recently:
I was recently surprised to find that the in keyword in AS3 has two meanings. I had been using it as part of the for-in and for-each loop syntax for a long time. Turns out it is an operator of its own. Read on for details.
AS3 has two ways you can typecast a variable. These ways are not equivalent. Let’s take a look at how they differ:
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:
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…