Archive for June, 2011

Improving Vector3D

The Vector3D class debuted in Flash Player 10.0 as Adobe’s official implementation of, well, a 3D mathematical vector (not the pseudo-Array class 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 Vector3D derivative—Vector3DExt—that fixes all of these problems by extending and improving on the original.

Read the rest of this entry »

Tags: , , , , , , , , ,

5 Comments

Loops With int and uint

AS3 has two integer types: int and 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.

Read the rest of this entry »

Tags: , , , , , , , , ,

8 Comments

Better OOP Through Namespaces

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.

Read the rest of this entry »

Tags: , , , , , ,

8 Comments

Advanced break and continue Statements

There’s more to AS3′s break and 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 break and continue statements in AS3 resulting in nicer—and maybe even faster—code.

Read the rest of this entry »

Tags: , , , , , , ,

15 Comments