In Cairngorm you can associate helper classes for views. For instance, I have a package with all of my views, and in that package is a subpackage of helpers.
Each view has it's own helper, so MainMenu might have MainMenuHelper as a class, which extends ViewHelper. ViewHelper registers itself with the singleton ViewLocator, so that you can access the logic of any particularly ViewHelper from anywhere in the application. I went further and have each helper implement an interface I call IViewHelper, which has two methods: enter() and exit(), which the SwitchStateCommand executes any code in them upon entering or exiting a screen. This makes me able to have alert windows show up if someone tries to leave a screen without saving their work, for example. I have the views set up like this: Class BaseState extends VBox and has within it: [Bindable] protected var model : Model = Model.getInstance(); This is so I don't need to keep getting the model for each view I design (in case I need to bind any of the fields to a property in the model. Then each of these BaseStates include their helper. e.g., MainMenu.mxml would have: <helper:MainMenuHelper id="MainMenuHelper"/> The helpers set up like: class MainMenuHelper extends ViewHelper implements IViewHelper Make sense? Brennan --- In flexcoders@yahoogroups.com, "Sam Shrefler" <[EMAIL PROTECTED]> wrote: > > Brennan: > > Thank you very much. What do you mean by ViewHelper? Does each View in the > ViewStack have a viewHelper? > > Thanks > > Sam > > > > On 8/31/06, dreuimar <[EMAIL PROTECTED]> wrote: > > > > I started out using states, with the current state being bound to a > > property in the model (using Cairngorm.) Lately, as my application has > > dozens of screens and different users are privelaged to have certain > > screens at their disposal, I use a view stack (it's easier on the eyes > > to program, IMO), and have each state's viewhelper extended to > > register that given state as a screen object in an arraycollection of > > available screens. I also have a constants file of screen titles (my > > menu reflects the title of the current screen.) > > > > I register each screen with its static title (pulled from the > > constants class), and fire off a custom cairngorm event when switching > > screens. > > > > e.g.: > > CairngormEventDispatcher.getInstance().dispatchEvent( new > > ScreenSwitchEvent(Constants.MainMenu)); > > > > Then I have a class that implements Command and have it do a search in > > the screen array for any object who's title is Constants.MainMenu. > > I've found this to be the best way, mainly because I rely on > > permissions and some screens have read-write access, some only have > > read, etc. > > > > For a smaller application, you could just use states and have a string > > property in the model called currentState that the currentState of > > your VBox is bound to. (I say VBox instead of application because I > > want a menu bar to be at the top of every screen, so the content is > > loaded into the vbox.) Then switching screens is as easy as calling: > > model.currentState = Constants.MainMenu > > > > Brennan > > > > > > --- In flexcoders@yahoogroups.com, "Sam Shrefler" <sshrefler@> wrote: > > > > > > I'm just looking for an theory overview / suggestions on how to handle > > > multiple screens with nothing in common: > > > > > > For example, i have an application that I'd like to have a menubar > > on every > > > single screen. > > > After that, i'd have say 5 - 20 totally unrelated screens each with > > their > > > own display and function. > > > I see on each of those screens where viewStates would come in handy. > > > > > > My question is: > > > > > > Should I make viewStates for every single screen, or would using a > > viewStack > > > be better? Is there a best practice for an application with multiple > > > screens? > > > > > > Thanks > > > > > > Sam > > > > > > > > > > > > > > > > > > > -- > > Flexcoders Mailing List > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/