Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Best Practices

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-29-2008, 05:11 PM   #1
ndmccormack
Registered User
 
Join Date: Feb 2008
Posts: 8
Default MVC help

Hi there,

I've been learning AS3 for a month or so now - reading Advanced AS3 by Collin Moock and AS3 with Design Patterns, doing some small projects - and, more or less, it all sorta makes sense.

I'm now going to embark on creating a website for a friend/client on the cheap and I just want to make sure I'm using the correct method for outlining the site.

The site is a standard folio site - Homepage, News, Work, About, Contact. I'll go into a little detail as how the site animates/is constructed.

- The pages are 'stacked' on top of each other, and scroll vertically to the required section when the user interacts with the nav.

- The nav has some fancy interactive wires on it that correspond to each nav option, these animate between sections.

- the work section scrolls horizontally through all the projects - similar to how spin.co.uk works.

- the site is updated via xml.

- I'd like to create a proxy image loader so that the work images load in the bg after the main swf/site has loaded.


Now, I presume that I create a main controller that then loads in the following

Main Controller
- DataLoader ( loads XML, stores data)
- - ImageProxy ( sequentially loads all work images )
- Main View ( stacks other views vertically )
- - progressBarController ( get's loading proogress of site, XML, bg image )
- - - progressBarView ( shows loading progress )
- - Navigation controller
- - - Nav Vie
- - - - Fancy Wires
- - Homepage Controller
- - - Homepage View
- - News Controller
- - - News View
- - Work Controller
- - - Work Model/Data ( pulls images from image proxy )
- - - Work View
- - About Us Controller
- - - About Us View
- - Contact Controller
- - - Contact View


I'm confused as to whether I should have more Models/Data classes, is one enough? once the XML has loaded should I parse the data out into other Data classes - one for each section? I realised that it would be best to have a Work Model class as it is relatively complex.

Am I missing the point of MVC, can I simplify it in other ways?

Any help is much appreciated

Cheers
Niall
ndmccormack is offline   Reply With Quote
Old 03-02-2008, 07:41 AM   #2
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
Default

My basic set up is this...and it isn't MVC. I basically follow 1 rule: 1 purpose for 1 class.

navigation - class
transitions - class
each "scene" - class
sound fx - class

now with in that I may or may not use MVC, but that's my basic structure for the site. The Document Class merely instantiates all the other classes.
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman
Flash Gordon is offline   Reply With Quote
Old 03-05-2008, 08:45 PM   #3
yell0wdart
jordanrift.com
 
Join Date: Sep 2007
Location: Phoenix, AZ
Posts: 297
Default

I tend to agree w/ Mr Gordon above. Not MVC specific, but definitely very good practice. You should be able to describe what any of your given classes do in a short sentence. If you find yourself drawing out the description with lots of and's, etc, then it might be time to rethink your design.

With that said, how are you setting this up? What does your class hierarchy look like? I can see the different functions in your list there, but it's hard to make out exactly where you're having problems...

/edit

I'd also argue, that if you're only using one datasource (seems to be XML in your case), then only one model may be necessary. You're just using a singular class to parse through XML text and attributes.
__________________

bad developer

Jordan Rift

Last edited by yell0wdart; 03-05-2008 at 08:52 PM..
yell0wdart is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MVC: When should the view change itself? Flash Gordon Best Practices 28 01-16-2008 06:11 AM
MVC and complex objects kribba Best Practices 4 11-08-2007 01:28 PM
MVC tutorials etc for AS3 (Flex) aftershock ActionScript 3.0 2 08-30-2007 06:53 PM
Moock's MVC Clock Prpl_Ppl_Etr ActionScript 2.0 1 05-02-2007 08:46 PM
MVC media player arkum ActionScript 2.0 0 04-03-2007 11:09 AM


All times are GMT. The time now is 08:43 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.