Site Project Log

A history of the evolution of tomleslie.ca. Lessons learned and plans for the future.
tomleslie.ca

Thursday, January 25, 2001

Not entirely related to building *this* site, but I thought I'd post a couple of the lessons I've learned about Macromedia Flash the last couple of days. Who knows -- I may take another crack at Flashing this site before too long. I'm using Flash 5.0, which is nice but suffers a bit from Macromedia's bizarre menu setup. It's doesn't follow many of the Microsoft office conventions and is consequently much harder to learn how to use than it should be. Still, it's a very, very cool tool.

#1 - objects and instances

As with many of the best estensible development tools, Flash uses an object-oriented development model that allows for a lot of flexibility and control. Why is it that few or no implementations of object-oriented development tools make this clear from the start? Flash hides the model and as a result it's harder to learn.

Anyway, Flash objects are either graphics, buttons or movies. Objects can be created in two ways: name it first and fill it in later, or create it first and name it later. For graphics and buttons this is pretty much obvious, but for movies it's much less so. I got used to creating a graphic and turning it into an object, but you can't really do that to create a movie. What you can do, is create the movie sequence and copy it from the main timeline into a new, empty movie object. This probably seems self-evident to experienced Flash users but it really gave me some trouble initially.

The big advantage of creating an object, particularly a movie object, is the reusability. You can have different coloured and sized objects scattered throughout your Flash video and they'll share the same characteristic movement, etc.

The key to remember here, is even if you've only got one copy of a movie object on the screen, it's still an Instance of the object, not the object itself. Controlling it means sending instructions to the instance. You can't send instructions to an object, since it represents an ephemeral group, not the specific instance you happen to have on your screen. Before you can send instructions to your instance you have to name it. As with many of the more useful Flash functions, naming an instance can be done only by calling up the Instance Panel, which is a bit boneheaded (has no-one heard of a Property menu at Macromedia?). Once you've named your instance, sending it instructions is trivial.

I did discover that while you can seemingly rename an instance over different sections of a timeline, the new name doesn't actually mean anything and you can't use it to refer to that instance.

#2 - target circle

Ok, this probably isn't something you care about unless you actually want to build a target circle, but here's another example of overly complex Flash functions. If you've been through the tutorial in Flash you know that graphics within the same layer interact with one another; if you drop a filled area so it overlaps another filled area, it actually obliterates the portion of the other area that's "below" it. What I discovered is that this doesn't work for lines. I tried to create a circle and rotate it through 360 degrees so my target lines would extend inward with consistant angle and length. This worked, but what I didn't realize is that every time I dropped a copy of the circle, rotated, on top of the original it did not overlap the original perfectly. Each copy had multiple intersection points with the circle underneath (probably lots and lots) and when I'd finished the resulting mishmash of overlapping circles had thousands of line segments that were essentially impossible to edit without wiping them out and starting again. The way to solve this would have been to convert the outside line to a fill, which would allow the lines to be merged much more effectively.

More if I remember it later...