Archive for category AS3

With Blocks

Tags: , ,

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 article »

4 Comments

Dynamic Access Part 2: Dynamic Classes and Plain Objects

Tags: , , ,

Welcome to the second part of this series on dynamic access. Last time we covered indexing arrays and vectors. This time we’ll talk about dynamic classes and plain objects. These are definitely something to watch out for when writing performance-critical code.

Read the rest of this article »

No Comments

Making Vectors Out Of Mixed-Type Arrays

Tags: , ,

The chief quality of Vectors is that they hold a single type of object. This is why they are sometimes called “typed arrays”. So what would happen if you wanted to convert an array of mixed-type objects into a vector?

Read the rest of this article »

No Comments

Class Bootup

Tags: , ,

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 article »

2 Comments

Function Variables

Tags: ,

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 article »

6 Comments

Overriding Variables

Tags: , ,

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 article »

3 Comments

AS3 vs. JavaScript Performance Test

Tags:

With the announcement of WebGL last Friday I started to wonder about the relative performance of AS3 and JavaScript. This is what I’ve found.

Read the rest of this article »

9 Comments

Dynamic Access: Part 1 (Indexing Arrays and Vectors)

Tags: , , ,

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.

Read the rest of this article »

1 Comment

Comparing Objects

Tags: , ,

The comparison operators (<, <=, ==, >=, >) are clearly core to any programming language. The AS3 docs tell us a little about AS3’s special handling of strings when compared, but there is more to the story.

Read the rest of this article »

5 Comments

Initializing Constants

Tags:

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

Read the rest of this article »

No Comments