1 Reply Latest reply on Jan 9, 2012 1:37 PM by saisri2k2

    Dynamically load contents in NavigatorContent inside Viewstack


      Thanks for helping.




      How do I dynamically load components or buttons inside a NavigatorContent when the user clicks the

      appropriate NavigatorContent Label inside the viewstack that is inside the TabBar component?


      Code sample..


      <s:Scroller id="scrollerHome" includeIn="home" x="3" y="8" width="933" height="584">

        <s:VGroup width="100%" height="100%">

          <s:TabBar dataProvider="{viewstackHome}"/>

            <mx:ViewStack id="viewstackHome" width="936" height="553">

              <s:NavigatorContent width="100%" height="100%" label="Tab 1">





              <s:NavigatorContent width="100%" height="100%" label="Tab 2">










      When the user clicks on Tab1 or Tab2 depending upon the time of day I want to

      display a different set of components that can even vary in number.


      Is there an event that I need to handle, if so what. I could not find any in these objects.


      Any other suggestions also welcome.




        • 1. Re: Dynamically load contents in NavigatorContent inside Viewstack
          saisri2k2 Level 4

          Since this is navigator content, all the components are created automatically at the load of hte application they do not obey the creationpolicy.


          1st way of doing: I would catch 'hide'/'show' events on the navigator content to listen for the event and add child elements dynamically.


          2nd way of doing: Instead of Viewstack i will go with spark states.


          <state name = 1/>

          <state name = 2/>

          <state name = 3/>



          <someContent includeIn = '1'/>

          <someContent includeIn = '2'/>

          <someContent includeIn = '3'/>


          and on creationComplete of these components you can handle what to display and what not to.