Posts Tagged constructor

Constructing Arrays

In AS3, you can create an Array can be created with special syntax: myArray = []. You can even fill the Array with values all in one go: myArray = [1,2,3,4,5]. This is a nice shorthand that saves some typing compared to using the constructor: myArray = new Array(1,2,3,4,5). But, which way is faster? Today we find out! UPDATE: added a third way of creating arrays

Read the rest of this entry »

Tags: , ,

9 Comments

Class Bootup Part 2

Today’s article follows up on an article I wrote way back in August of 2009 about the order of operations when you use a class. In the original article I showed the order of field initializers and constructors. Today I’m expanding on that to show three more chunks of code that are run. Can you guess what those chunks are?

Read the rest of this entry »

Tags: , , , , , , , ,

7 Comments

Super Is (Really) Optional!

Like Java, AS3 has a super() function you can call from your constructor to call your parent class’ constructor. As it turns out, this is more optional than you might think.

Read the rest of this entry »

Tags: ,

5 Comments