3 Replies Latest reply on Nov 21, 2006 7:43 AM by M. Huisman

    show / hide + tab + tabNavigator

    ljonny18 Level 1
      Hi.

      I have a webService which gets the "user type" (admin / general user) of a user and sets a variable within the Flex 2 application relevent to this.

      - generalUser
      - adminUser

      and I have a tabNavigator with the tabs A, B, C and D:

      <mx:TabNavigator id="tn">
      <vBox id="a" label="A">content</vBox>
      <vBox id="b" label="B">content</vBox>
      <vBox id="c" label="C">content</vBox>
      <vBox id="d" label="D">content</vBox>
      <mx:TabNavigator/>

      e.g. I want to allow the "generalUser" to see tab A and B and the "adminUser" to see tab C and D etc.....

      I assume you check the user type and then create the tabs accordingly..... but I dont know hoe to do this :(

      i.e.

      if(user = admin) {
      create tab A, create tab B
      }

      but then I have the question - what about the content within the tabs? hence I was wondering if you could jusr show / hide the tabs depending on the user type(s) etc....................

      sorry - I am a bit cinfused as to how to go about this one, so any help is appreciated.

      thanks,
      Jon
        • 1. Re: show / hide + tab + tabNavigator
          clementyew
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
          <mx:VBox x="40" y="114" height="190" width="181" visible="{truefalse.text}">
          <mx:Label text="true=visible, false=not"/>
          </mx:VBox>
          <mx:TextInput id="truefalse" x="249" y="28"/>
          <mx:VBox x="249" y="114" height="196" width="192">
          <mx:Label text="Always visible"/>
          </mx:VBox>
          <mx:Label x="52" y="30" text="Type &quot;t&quot; for visible, &quot;f&quot; for not :"/>

          </mx:Application>



          Try this sample application. It's basically using the visible property of the Vbox. Hope it helps.
          • 2. Re: show / hide + tab + tabNavigator
            ljonny18 Level 1
            hi.... thanks for the post - although it does not really help me - maybe I did not explain myself correctly.....

            I have a tabNavigator within my Flex 2 application containing different tabs - of which I want to remove (no show within the tabNavigator) depending on the user type

            i.e. one type of user can see one set of tabs whereas another user type can see others etc... all within the same tabNavigator!


            Thanks,
            Jon.
            • 3. Re: show / hide + tab + tabNavigator
              M. Huisman Level 1
              Try making different state's for a certain user.

              So if the user is an admin, the currentState is set to admin, otherwise it's the default State.