View Full Version : how would YOU do a dynamic website?

08-28-2009, 07:13 AM
In learning about the various ways to make dynamically controlled websites with actionscript, I wanted to ask all you flash developers out there how you do it and what your preferred methods are, and what you find the advantages to be. For instance do you like to cut your website up into sections making separate swf's for each section and using the Loader class to bring them in? Or do you like to just make dynamically linked movie clips within one main swf and call them to the stage as needed? Or do you do something else really cool that I've never even heard about?

*unnecessary reading below*

If it helps some new guys out there (I still consider myself one) this has been my progression in learning Flash and my approach to developing websites: my first few websites were entirely timeline based where I'd attach frame labels to the timeline and have the website divided into sections by linking the menu buttons to these labeled frames. That's how you would navigate to different sections.

Then I learned about loading movie clips dynamically with actionscript. So instead of having to attach frame labels, I would have essentially a one frame flash movie for the whole site with just a menu bar on top. I would link each menu button to a moviclip (using the "export for actionscript" option) that I'd load and unload with the addChild method. This was the new way to navigate to different sections of the site. This was a big milestone because frame-based movies got to be very clunky after a while.

I then discovered the Loader class where I could make each section of the website it's own separate swf file entirely and they would only be called as needed, instead of having to load the whole site all at once at run time. I am now getting my feet wet with custom classes and trying to make everything reusable so that I can tackle new projects even faster and more efficiently than before.

08-28-2009, 02:30 PM
This probably belongs in the General Chat forum. Hopefully someone will move it there.

It sounds like you're taking the steps that every Flash developer takes, which is good. Everyone's got their own subtle ways of doing things, but a fully object oriented way of programming should be your goal. AS3 was restructured with this intent specifically in mind. I don't remember the last time I did anything on the timeline. And I only occasionally create a MovieClip on stage to have in the library. Reusability and easy modification should be at the forefront of your thought process. Building classes that have loose coupling (they don't rely too heavily on knowing each other's internal workings) will make it very easy to add to, subtract from, or change how a certain part of a site works.

I really don't like the "each section as a separate SWF" method of building a site. For various reasons, but namely there there is often an enormous set of code that is commonly accessed by every part of the site. If each SWF has to contain that whole batch of code, it's a waste of resources.

I generally try to structure things so that I end up with a main.swf that contains all the application behavior code, a fonts.swf that holds just the font assets needed, and an assets.swf that holds my library of stage-created assets. If the asset library is large, I may split THAT up into multiple SWFs based on the sections they belong to. That way a section's assets aren't loaded until the section is viewed. All images, sounds and videos are kept external and loaded at runtime only when requested. All the content data is also kept external. Depending on the technologies available for the site, it may just be kept in XML files, or it may all be in a database (which is queried and can send an XML response). In either case, XML is my preferred method of reading in data...super easy to parse and manipulate.

I guess that's kind of a vague idea of my approach to things. If that brings to mind any specific questions, feel free to ask.