3 Replies Latest reply on Dec 20, 2007 10:59 AM by m_hartnett

    Best Practice

    GeorgeWS Level 1
      I have built 10 flex 2 applications with CF7.02 as the back. I want a person to log in an get access to 4 of the applications and another person might have 7. I want the users to login and have the same number of buttons as they have rights to. So the first person with see 4 buttons and the second 7 buttons. How do you do this. I have been messing around with the link bar and viewstack but can seem to get them to be dynamic. just static. WHERE ARE THE SAMPLES? I cant be the only one wanting to do this. Thanks

      George
        • 1. Re: Best Practice
          ntsiii Level 3
          Have a successful login return or lookup the configuration for the current user. Then, build the navigation elemnt from that configuration data. I use repeater for this a lot.

          Tracy
          • 2. Re: Best Practice
            GeorgeWS Level 1
            No sample? I am having such a time getting the array to have the "" marks so it can be used in the array for the buttons

            im stumped as usual...

            Please please help me
            • 3. Re: Best Practice
              m_hartnett Level 3
              is this what you are looking for.
              This is just how to dynamically create a linkbar with a viewstack.



              <?xml version="1.0"?>

              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
              layout="absolute"
              creationComplete="createCompleteHandler()">
              <mx:Script>
              <![CDATA[
              import mx.controls.Label;
              import mx.containers.VBox;

              public function createCompleteHandler() : void {

              var vb1 : VBox = new VBox();
              var lb1 : Label = new Label();
              lb1.text = "here is a label 1";
              vb1.setStyle("backgroundColor","#fc55bcd");
              vb1.addChild(lb1);
              vb1.id = "vb1";
              vb1.label = "stack 1";

              var vb2 : VBox = new VBox();
              var lb2 : Label = new Label();
              lb2.text = "here is a label 2";
              vb2.setStyle("backgroundColor","#ccf555");
              vb2.addChild(lb2);
              vb2.id = "vb2";
              vb2.label = "stack 2";

              vStack.addChild(vb1);
              vStack.addChild(vb2);

              linkBar.dataProvider = vStack;

              }


              ]]>
              </mx:Script>
              <mx:LinkBar id="linkBar" x="10" y="10" dataProvider="vStack">
              </mx:LinkBar>
              <mx:ViewStack id="vStack" x="10" y="63" width="200" height="200">

              </mx:ViewStack>

              </mx:Application>