1 Reply Latest reply on Oct 5, 2006 7:32 PM by inlineblue

    Adding Tabs at Runtime

    Softalot Level 1
      I am new to Flex (doing ok in JS though) so forgive me if I ask a total newbie question:

      I would like to dynamically add, remove, and rename tabs (=canvas items) at runtime. For example after a user logs in he would get a few additional tabs, that sort of thing.

      1. Is it possible?
      2. If so is there a standard way of doing this? For example by first giving an ID to the TabNavigator component and then working some kind of newitem(), delitem(), etc. methods on the object?
      3. Could it also be done in a declarative manner (dynamically producing XML and loading it at runtime) ? This could be produced by any application server, i.e. PHP or ASP ..the question is can it be interpreted at run time?

      I am asking this question early on, because its kind of important for my project.

      Thanks for any advise on this.
        • 1. Re: Adding Tabs at Runtime
          inlineblue Level 1
          Yes, first give the TabNavigator an id. Then you can use addChild() and removeChild() (and their variants) on the TabNavigator. These methods are common to all Containers. Renaming a tab is just a matter of changing a Canvas's label.

          If you want to use XML to specify the tabs, you'll have to interpret the XML yourself and create/add the appropriate tab children at runtime.