Introduction

You are currently browsing the weblog archives for July, 2003.

Archive for July, 2003

Thursday, July 31st, 2003

With()

I just realized how faulty with() is in Flash. Well, I knew that it is faulty but I didn’t know that it has an affect on the super Object. Here’s an example:

SuperClass = function(){};
SuperClass.prototype.init = function(){
        trace(”SuperClass: init“);
}

SubClass = function(){};
SubClass.prototype = new SuperClass();
SubClass.prototype.init = function(){
        trace(”SubClass: init“);
        super.init();
}

myObj = new SubClass();
with(myObj){
        init();
}

The output is:
SubClass: init

and not like expected:
SubClass: init
SuperClass: init

If you replace the with call with the following code the script works properly:

myObj.init();
Sunday, July 27th, 2003

“Abstract Factory” Pattern

The Abstract Factory Pattern is the first Pattern I learned about. I think it’s one of the patterns you can use in almost all projects. The idea behind it is “to provide an interface for creating families of related of dependent objects without specifying their concrete classes”. If you search in google for “Abstract Factory Pattern” you’ll find a picture that demonstrates the relationships between the objects. Click on “read more” to see the example code I wrote. If I interpreted or impemented the design pattern in a wrong way let me know it.
(more…)

Sunday, July 27th, 2003

Design Patters: Elements Of Reusable Object-Oriented Software

I’m just reading this book. It’s fasciniting. The ideas behind the patterns are really amazing. I can’t wait to implement a few in some of my new projects. I highly recommend to buy this book. You change the way you look at code. It has a similar effect to me like “Refactoring” from Martin Fowler. So buy it and I guarantee you you will love it.

Wednesday, July 23rd, 2003

Windows Style Menu

Requirements:

1. two layers (one layer with the workarounds and the other with the menu code)
2. three empty movieclips with the linkage names: subButtonSymbol, mainButtonSymbol and popUpMenuSymbol
3. one xml-file named xmlMenuTree
that’s it. Click on read more to see the code.
btw: by now it’s just a beta version. If you recognize any mistakes or things that could be improved I would be thankful if you’d write me a mail.

download fla
download xml
show example
(more…)

Saturday, July 12th, 2003

Refactoring: Improving The Design Of Existing Code [Chapter 1]

Today I started reading Martin Fowler’s book about Refactoring. When I saw the example code for the first chapter I was shocked because it wasn’t written in ActionScript but in Java. It was the first time I saw a Java code. So I sat down and tried to understand how the code works. It took at least one hour. After I understood the bigger part I thought why not translate the example into ActionScript syntax. So here is the final result. If you want the code step by step (like in the book) write me a mail.
(more…)