Hi list,
I'm building an application that will contain a ViewStack with multiple
pages. After some experimenting I'm confused about the best practice for
using the ViewStack as a content holder. I'd like any advice anyone might
have on best practices please.
-- Situation --
I'm loading content via xml: 4 categories with each 50 pages full of content
(text, images, mp3's and pre-CS3 swf's). The user should be able to navigate
through these categories and each category's pages, using fancy transitional
effects, AND be able to use History to go backwards and forwards through the
path using a back/next button.
-- Solutions --
1. I could fill the ViewStack each time the categoryIndex changes with
the amount of pages it has in the xml. That way I can easily navigate
through them. However, when adding an image to each page, the memory begins
to clog up. So I bound the source with an additional condition:
source="{(visible) ? model.selectedPage : null}"
This works nicely, but now I get the feeling I'm not using the
ViewStack's functionalities correctly. Using this method the ViewStack has
49 invisible page-objects without content and one currently visible with the
correct content in it. Doesn't feel right for some reason.
2. I could add just one Page object to the stage instead of using a
ViewStack and bind model.currentPage to its content. However, this way
I can't use Effects to turn the page, nor States for a History
functionality. So this isn't really an option.
3. I could build my own PageManager that contains 2 pages. One for the
current content and another one to swap with, using an Effect. This manager
should also be able to keep track of States and add them to a custom
HistoryManager. The problem is that this will probably take up a lot of
time, and I'm sure there must be a far easier way using the default
components in Flex.
-- Question --
There must be many more examples around but I can't find the right keywords
to describe the situation. I hope someone has been working on the same
implementation as I am, and is willing to share his (or hers) experience
with me / us all.
Thanks in advance,
Bart Wttewaall