Grant Skinner

The "g" in gskinner. Also the "skinner".

@gskinner

OOP4AS2#5: Inheritance (extends and super)

Entry #5 in this series will deal with implementing class inheritance with the “extends” and “super” keywords. In this post, I will focus on the syntactic details of inheritance in ActionScript 2.0, and will likely post my opinions and thoughts how to apply that syntax separately.

Inheritance is a very important concept in Object Oriented Programming, as it allows for the development of highly modular and extensible code, which in turn reduces development time. It also allows developers to extend the functionality of pre-existing classes, without touching the original code.

Once again, this post builds on previous posts, so at the very least you should grab the code from entry 4 before proceeding. Also, if you’re looking for a great introduction to all the new goodies in F04 (Flash MX 2004), be sure to pick up the forthcoming “FlashMX 2004 Demystified” from Macromedia Press.

Read on…
Continue reading →

OOP4AS2#4: Dynamic classes

Installment 4 of my series on Object Oriented Programming with ActionScript 2.0 will cover dynamic classes – a relatively simple topic, but one worth being familiar with so as to avoid frustration.

Again, if you haven’t read the previous posts, you should because they all build on one another. Also, if you want all the nitty gritty details, you’ll have to buy “Flash MX 2004 Demystified”, which is forthcoming from Macromedia Press.

By default, the actionscript 2 compiler in FlashMX 2004 will not allow you to add new properties or methods to instances of a class. Attempting to do so will result in a compiler error.

Read on…
Continue reading →

Important note on AS2 properties

I neglected to mention this important point in OOP4AS2#2 – when creating array or object properties for classes, you must initialize them in your constructor as with “goodList” below. The “badList” array property below will share the same data amongst all instances of the class:

class MyList {
var goodList:Array;
var badList:Array = new Array();
MyList = function() {
goodLlist = new Array();
}
}

Bokel has a good description of the issue, with some sample code here.

OOP4AS#3: Constructors

Installment 3 will build on the previous 2 parts (so if you haven’t read them already, you should), by taking a look at how to create a constructor function for a class in ActionScript 2.0.

A constructor lets you pass in parameters when you create a new instance of a class, and use those parameters to set properties and carry out operations on the new instance as it’s created.

Read on…
Continue reading →

Global search and replace

This has got to be one of the coolest new features in Flash MX2004: Global Search and Replace. Go to Edit, and select “Find…” and you will be shown the new search and replace panel. You can search for virtually any type of asset in your entire FLA: Text (script and/or text content), Images, Sounds, Fonts, etc.

While it still seems a little buggy, and it’s a shame it has no undo capability, or the ability to search on an entire project, it sure will save me a lot of time. I don’t know how much of my short life I’ve wasted hunting in vain for the final occurence of a font in a FLA, trying to eliminate the extra 20kb added to the SWF because I’m using both bold Arial and Arial Bold.

Goodbye Movie Explorer!!