Loading design problems

I’m making educational games for a local business and noticed that most of the games has the same interface, copied, pasted and rarely changed. Looking like a great thing to automate, I started making classes to handle the bars, windows and most common things like lives and time.

It’s currently working great, but one thing occurred to me: the “template.swf” file, containing the resources, is (too) quickly becoming quite big with so many new items

The “template” file is composed by a library of class-exported symbols (can I access them without it?) of two kinds:

  • upper and lower bars, containing links, sound options and small buttons like “next”, “restart” and “help”; a simple preloader; “Congratulations!” and “Game Over” window dialogs – this never changes

  • Windows with school-like questions to be used when the user does something wrong and small graphics to be added on the preloader and “end” screen – this usually changes from game to game, but has no need to

To prevent future headaches, I want to solve this as soon as possible. I can think of three options:

  • selectively loading symbols from the template without loading the whole file (is this possible?)
  • splitting it into “general interface” and a small resources files for each game (will become cluttered in no time)
  • including those small resources into the very game file (which would kill the option to easily reuse the questions or graphics)

None of them look good enough. So, what would be a good way to organize this situation?

P.S.: I’m currently using something along this lines, in the “Event.COMPLETE” handler function, after pointing a Loader class to “template.swf”:


var resourceClass:Class = e.target.applicationDomain.getDefinition(resourceName) as Class
resource = new resourceClass()