On Mon, Jan 5, 2009 at 10:45 PM, endrone endrone <endr...@gmail.com> wrote:

>> It's either the TabNavigator's 'change' (your current method) or its
>> children's 'initialize'. It's hard to say without knowing more about the
>> sort of initialization you're doing here.
>
> I'm not using states.
> Assume you have 2 categories who have more or less the same settings.
> When you click a category, you get a dynamic generated settings page.
> You remember the chosen category so you can add dynamically the correct
> components.
> (assume I have different tabs, eg Settings, Content, About)
> If I choose another category, I need to reinitialize that settings page.
>
> Now it's done with catching the change event.
> Are there other ways?

Okay, I think I understand it better now. So you have different views
for each category. Unless the views really need to be dynamically
generated, you don't have to do it. You could create different views
like CategoryASettings, CategoryBSettings, CategoryAContent,
CategoryBContent, CategoryAAbout, ... and use them in the following
manner:

  <TabNavigator>
    <ViewStack label="Settings">
      <CategoryASettings />
      <CategoryBSettings />
      <CategoryCSettings />
    </ViewStack>
    <ViewStack label="Content">
      <CategoryAContent />
      <CategoryBContent />
      <CategoryCContent />
    </ViewStack>
    ...
  </TabNavigator>

You can combine this with states so that the relevant views are
automatically selected when you switch category. That, I would say, is
the Flex way. But you might have performance concerns here depending
on how many different categories you have ... so think about that.

If you must generate the views dynamically every time a tab is
selected, then I think the change event is the way to go.

Manish

Reply via email to