My first script generated from scratch with Flash MX Professional 2004. Well, it’s just a digital display (I hope this is the right expression).
Drag the DigitalDisplay MovieClip from the library on stage. Set the parameters. And you are done.
There are two parameters. One that defines how many digits the number has you want to display. And another that defines the number that should be displayd.
You can set an interval to put a counter into effect etc. The fla contains an example for this.
Archive for September, 2003
Digital Display
Drawing API
This is my first drawing API. It contains the functions to create Rectangles, Parallelograms, Circles and Lozenges (I hope that are the correct mathematical expressions). From time to time I’m going to add more shapes.
If you want to create a rectangle you have to type:
this.createRectangle(”theRectanglesName“, depth, initObj); this.theRectanglesName.draw();
Before drawing the rectangle you can also set basic properties like: width, height, border, fill etc.
I used the composite pattern to structure the code. It allows you to create one graphic that contains other graphics and so on (See the isoMap example). You can create a graphic container with the createComposite function and add graphics to it via aComposite.addGraphic(aGraphic). To draw all graphics inside the composite you only have to call the draw() function on the composite.
createRectangle
What I don’t like about most drawing API extensions are the many steps you have to do to create a simple rectangle or circle etc. I find it just too intricately.
e.g. the drawing API from zoode.org (btw. it’s a really good and most notably complete extension):
At first you must create a new MovieClip.
var emptyMovieClip = this.createEmptyMovieClip(”mc“, 100);
After that you have to create a new Rectangle2D object and to pass the MovieClip as a argument in.
var myRect = new Rectangle2D(emptyMovieClip);
Then you must define the x, y position as well as the width and height.
myRect.setRect(20, 20, 100, 50);
And at last you call the draw function on the object.
myRect.draw();
Well, I think that are quite to many steps and to many objects to draw a simple rectangle. If you want to draw one rectangle you should only have to create one object: the MovieClip.
With my new extension you just have to write:
this.createRectangle(”ractangle_mc“, 1, {_x:20, _y:20, width:100, height:50});
to achieve the same effect.
(more…)
Isometry Engine
Isometry is a quite fascinating subject. When I first saw www.taobot.com I really was overwhelmed. The design, the interaction between different objects and so on. So I sat down and wrote a little script on my own (the following isometry engine). Unfortunately it didn’t work like I wanted it to.
Now I know why. The people from www.taobot.com used a different approach. A little explanation how they did it can be found in the book: Flash MX Professionell from Carlo Blatz.
I’ll try to write an engine for this approach too. And maybe you can download it in a few weeks.
