Posts Tagged variables

Local Variable Caching

Recently, I’ve seen a lot of performance-critical code that has made heavy use of field variables. For example, an expensive loop might look like this: for (var i:int = 0; i < this.numObjects; ++i). I've recommended to some of the programmers writing such code that they modify it to cache the field variable as a local variable to improve performance. Was I right to recommend this? In today's article I'll examine the read and write times to see if caching field variables locally really improves performance.

Read the rest of this entry »

Tags: , , ,

12 Comments

Argument Clash

I am often burned by MXMLC: the AS3 compiler. When I am, I find this infuriating and look for the reason why this happened. Today I’ll tip you off about this problem and delve into what it means if you happen to trigger it.

Read the rest of this entry »

Tags: , , , , ,

No Comments

With Blocks Part II

I wrote an article last summer about with blocks, but really only touched on basic usage. Today I’ll delve into their internals a bit and discover some surprising aspects.

Read the rest of this entry »

Tags: , , ,

No Comments

With Blocks

While plainly documented by Adobe in the Flash 10 AS3 Docs, it seems as though few programmers know about the with statement. I don’t use them much personally, but when a coworker came across one in my code recently and was puzzled, I figured I would write a quick article to cover their usage.

Read the rest of this entry »

Tags: , , ,

4 Comments

Class Bootup

Being allowed to declare and define member variables all at once introduces a question: in which order does the class boot up? Further, if the class has parent classes, how does this change things? Read on for the simple results.

Read the rest of this entry »

Tags: , ,

2 Comments

Function Variables

AS3, AS2, and JavaScript have some strange rules regarding the initialization of variables. These are shocking and perhaps ridiculous to users of C and Java. This article covers one particularly insane quirk.

Read the rest of this entry »

Tags: ,

6 Comments

Overriding Variables

AS3 makes some strange things possible. Even stranger, it seems to do this without any warning by its compiler: MXMLC. It seems as though one of these strange things is the ability to override the variables of your parent classes.

Read the rest of this entry »

Tags: , ,

3 Comments

Initializing Constants

Today I bring to you… another silly compiler quirk! Read on for the silliness.

Read the rest of this entry »

Tags:

No Comments

Pointless Code

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:

Read the rest of this entry »

Tags: , ,

7 Comments

Nested Functions and Function Variables

Turns out that AS3 supports ! I have been making Function variables for a long time. Read on for the greatness that is nested functions.

Read the rest of this entry »

Tags: ,

No Comments