R – Flash Site Architecture – one swf vs many

actionscript-3Architectureflashweb

I'm about to start building a site entirely in flash (per the client's request), using AS3, and was wondering about best practices for doing so in terms of application architecture. The site isn't too large–think homepage, persistent nav, 8 subsections or so, each with their own content but similar design between subsections. In the past, I would have used multiple swfs (say, one for the nav and one each for the subsections) and loaded them dynamically; now, though, I'm considering taking a different route and using a more object-oriented design, with lots of classes and just one swf (plus a preloader to load it).

Are there any best-practices for determining whether it's better to dynamically load smaller swfs vs building a single large swf? In AS2 I think loading many smaller swfs made more sense, but with AS3's stronger object-oriented capabilities I'm wondering if that's still the case.

I know that one argument against the single-swf design would be the added weight of loading everything upon initial siteload, but I don't think there's enough heavy content that it's of real concern here.

Any thoughts?

Best Answer

In my experience, the common practice these days for (most) small to medium Flash websites/applications is a two SWF architecture, a shell that loads a core. Sometimes you can get by with just one SWF that tracks its own load progress. That said, you want to load content and assets on demand; images, video, animations and large textual content. These typically should not be embedded in the core SWF but loaded on user request. The primary advantage in either case here (one vs two SWFs) is code maintenance. You only need recompile the core SWF when you make updates to the application. In this model, you could still load additional SWFs that contained timeline-based animations, as long as you kept your application code in the core.

Hope that helps!

Related Topic