Vector3D class debuted in Flash Player 10.0 as Adobe’s official implementation of, well, a 3D mathematical vector (not the pseudo-
Vector). Weirdly, it has a
w component and is therefore technically a 4D vector, but its API inconsistently make use of the fourth dimension. There are also strange oversights, inefficiencies, and functionality it really should have always had. Read on for my custom
Vector3DExt—that fixes all of these problems by extending and improving on the original.
Archive for June, 2011
AS3 has two integer types:
uint. In my experience, most AS3 programmers just use
int everywhere and ignore
uint. This is usually acceptable as the need for unsigned integers is rare compared to their signed counterparts. However, there are significant performance differences between the two. Read on for the impact of
uint on your loops. The original version of this article’s performance test contained a small-but-critical error that led to a lot of incorrect analysis and results. This version of the article has been corrected.
Namespaces may make poor function pointers, but you’d be wise to not write them off so quickly. It turns out that they have an altogether different usage that can help you blend the speed advantages of public fields with the encapsulation and information hiding of getters and setters. Read on to learn more about this lovely compromise.
There’s more to AS3′s
continue statements than you might think. Chances are, you’ve used them to skip to after a loop (
break) and skip the current loop iteration (
continue), but they can do so much more. Today’s article will cover some of the advanced ways to use the
continue statements in AS3 resulting in nicer—and maybe even faster—code.