What are some good patterns for managing a bunch of views/screens in Flex?

284 views Asked by At

I'm building a Flex application with about a dozen different screens. There's relationships between the screens such as when on screen 1, I click on something that is an input to screen 2. Then I might bring up screen 3, then go back to 2 and then bring up screen 4. To make it clear to the user where they are in the application, we'd like to implement a breadcrumbs concept where the user gets to see which screen they are and be able to navigate back up the trail they came from.

So in thinking about how to implement this, it seems to me that I should have a stack of views. Views get pushed onto the stack, then popped off. The breadcrumbs would be a visual depiction of that stack, eg: Home >> Alert 123 >> Customer B Summary >> Customer B Detail

Having said this, I'm trying to come up with a pattern for how to implement this. The obvious starting point would be a mx:ViewStack as a container. Then I'd add views as children and make them visible - effectively "pushing" then onto the view stack. Then to close that screen I'd remove them as children to "pop" them off. This would have to update some stack data structure somewhere that the breadcrumbs would be able to see. In fact the breadcrumbs themselves can modify the stack when the user clicks on an item in the breadcrumbs to jump to.

In any case, I'm going to be working on this but just curious if anybody has anything to share around any patterns/frameworks you've used to manage multiple screens and how they come up and go away and navigate between them that I can use for some ideas.

Seems like a simple thing but in practice it's not always straight-forward.

2

There are 2 answers

0
just_a_dude On

Just throwing some ideas, hoping it can help ... Maybe you could use the memento pattern? Or use a command pattern with a CommandStack?

0
Eran On

MVC i think would be helpfull to orgenize your code and have a rebustable application .

There is no 100% design pattern ,most times it is the way you implement it .

I find mvc great when having many views because it keeps your mxml pretty clean and small and when you add features you do it in a pure as class which keeps your code from complicationg.