Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: How would you plan your pureMVC framework for a banner?  (Read 6673 times)
nfh
Newbie
*
Posts: 2


View Profile Email
« on: April 17, 2009, 10:52:22 »

 Hi,

 Although a simple banner doesn't really benefit from an MVC framework due to its simplicity, I'm trying to figure out how would I use pureMVC do to it for training purposes.

 I'm thinking of those multipage banners (such as the one here: www.flashden.net/item/as3-xml-banner-rotator/25073) with the following functional areas:
a) a text area
b) a background image
c) a row of page buttons

 Here are my questions:

1) I suppose that the whole data for a "banner session" includes the image+text for all the pages. So this means that loading the initial data would be outside of the MVC framework anyway, do you agree? Or could we consider a single proxy holding all the data for all the pages and the only data that will generate notifications from the Proxy is the "current page number" (all the other data isn't suppose to change)?

2) each page button holds a simple text to tell its page number. Does it make sense to represent each button as a different visual component (thus holding a Mediator and eventually a Proxy of its own), or is it preferable to encapsulate its behavior on the "main" component (the banner itself)?

3) By encapsulating the page buttons on the banner component, when the user clicks a page number I would only need a single command to be executed (pageClicked, for example) which would receive the page number on the event instance, would you agree?

That's all for now :).
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: April 19, 2009, 05:58:15 »

Sure it could benefit from MVC. In the case of something like the rotator you pointed out, you need to read and parse some config (done in a Proxy in the model tier), then generate some components for display (probably using a Command in the controller tier) then insert them into the view (via a mediator in the view tier).

Its possible you'll want to overlay some next/previous buttons in the view (also owned by a Mediator to which they communicate by events, and which sends a notification on their behalf) that would cause the Mediator that owns the view stack (in Flex or AIR) or collection of Sprites (in Flash) to to rotate to the next banner.

-=Cliff>
Logged
Pages: [1]
Print