Archive for category AS2

Curry Functions

Tags:

In the midst of discussing my runnables technique for implementing function pointers over on the Rausch Generator Blog, I commented about the usefulness of the currying technique, mostly in callbacks. It occurred to me that I’ve been using a tiny helper class to curry functions for years in both AS2 and AS3, but that many people may have never stopped to write such a basic (in my opinion) class. So I figured I might as well re-implement the class and post it here.

Read the rest of this article »

7 Comments

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

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

Fun With Dynamic Functions

Tags:

Dynamic functions are a very useful feature of AS3 and JavaScript. Closures constantly come in handy for cleaner, more powerful code. Here’s a feature you might not know about them though.

Read the rest of this article »

No Comments

Details of NaN

Tags:

The constant NaN (not a number) can come up in a lot of situations. In AS3 it’s the default value of a Number field, it’s the result of division by zero in AS2, AS3, and JavaScript, and you can get it in a number of other ways. This article is about the reality of dealing with NaN.

Read the rest of this article »

2 Comments