mike chambers | about

How do you Architect your Flash Applications?

Wednesday, May 14, 2003

I have once again been doing a lot of application development with Flash, and have begun to create some more advanced apps / functionality. Previously, I would follow a few simple rules to organize my applications:

This actually worked well for applications which only had one state (such as the Stock Services app), but did not work well for more complex applications which had multiple states / screens.

When I started working on the GoogleSearch application I knew that it would have multiple screens (one for search, one for settings, and one for about information). I looked at the RSSify application (created by Greg Burch) included on DRK 3 which has a similar structure (although much more complex functionality).

I ended up doing the following:

This has actually worked out very well. I was worried that I would have trouble finding where the code was located, but I found that structuring my library made it even easier to work on and find the code:

My library basically became an ActionScript class browser.

All of my ActionScript classes are in external files (based on classes), so it is very easy for me to find and move between code.

The main issue I ran into was loading order (init clip). I ran into a couple of problems where I would try to access code that was not loaded yet. I solved this by having my screens broadcast onLoad events, that the main app class would listen for.

Anyways, how do you architect your movies? Have you run into limits with placing all of your code in one place? What do you think the best practice should be?

twitter github flickr behance