There is a little more to this system that regards optimization. In flash it is common to create some visual and then add it to the display list of some other container. There is nothing wrong with that but, with a little forethought we can slim down the display list by using the graphics property of the parent display container. That being said, instead of pre-creating the 3 button states (up,over,down) and then managing them based on the state of the mouse I went another way. I define the base for each state and then create descriptors for the properties that differ from one state to the next. The (basically) same way that I compile the object list, I do on-the-fly compilation of the button states. This happens directly into the graphics properties of the container. So, instead of 3 button state sprites and a label residing in a container, I only have a label in a container and the button states are drawn as needed into the containers graphics properties. This more or less means that each of my buttons is 2/5ths of the data with the exact same visual results. If it isn't clear, I obviously have an actual Button class which is managing itself based on the properties of the descriptor. And that's perfect cause the Button class is already exactly everything you would expect a button to be and do so, all modification comes down to customizing the descriptor. To make things even more robust I could make a Button2 descriptor with a classname of "Button" and when start up compilation happens everything I stated in my last post would happen but with Button2 properties taking precedence.

Since Button2 would only have to describe how it is different from Button the descriptor could end up being very small as it will inherit the rest from Button. Then if I wanted to use a Button2 I simply dump it in the Button CLASS interface when instanced.

var uidef:UIDefaults = new UIDefaults()
var button:Button = new Button("close", uidef.Button2); //where "close" is the label for this instance

And there is your example on how to make 10 billion different buttons using nothing but 1 Button class and potentially a very small overwrite descriptor that inherits from the original button descriptor. Everything gets smaller and smaller the more you create, with the only exception being if you wanted to make something entirely different. Even then it's practically effortless. I mean, look at that button descriptor in the image. How long do you think it took me to write that? 1 minute? 1 minute to design a button and maybe something like 30 seconds to design a new one. The graphic possibilities are not shitty at all regarding this, either. My GraphicObject class can handle every 2d possibility you could imagine. paths, gradient fills (linear/radial), images, matrix transformations, filters, complex shapes, on and on and on. It's not really an overstatement to say it's a programmatical photoshop. I could make super complex graphics. I'm more concerned with making things possible than illustrating every possible thing.