Object-Oriented Programming is just so much fun!
I was thinking, in a Flash animation, some elements have to be accessible (text and images) and some others don’t really have to (background color, ornaments…). Since almost everything is considered as almost the same in Flash (most elements in a Flash animation are movieclips), OOP can help me making a distinction between accessible elements and secondary elements.
Maybe I should have a class called “Element”, with methods such as “init”, “display” or “hide” and properties such as “x”, “y” or “transparency”. And I would have a class extending it that would be called “AccessibleElement” with properties such as “text” (this property could be considered as alternate text for images) or “rank” (if you have to render a simple layout for the content, you have to know what is the previous element and what is the next one).
The tricky thing is that some elements actually contain other elements. For example, an image gallery displays an image and at least two buttons to browse images (“previous” & “next”). I’m wondering, should I have a class called “image gallery” with an image element, a previous element and a next element or should I have the image element on one side and the buttons on the other side? These two buttons use a mechanism that could be reused for long lists of content for example.
I also thought of an abstract class called “Status” that would treat content just like web pages. This class is going to be very helpful for features such as deeplinking, bookmarking and even simple browsing, but maybe it could be included in a bigger class such as “Application” or something…
I’m wondering how I could work with Flash for so long without using OOP.