6 Replies Latest reply on May 18, 2009 3:48 AM by starfighter10

    panel.visible=true doesn't seem to work when logged in.

    starfighter10

      Hello,

      I’m tryin to make a flex application. When a user logs in there appears an extra panel. I’m trying to make this work with pnl.visible=false and when logged in pnl.visible=true. But somewhere there must be an error cause the panel is not seen, when logged in. On the base state you have a login button which shows the loginstate when clicked. There you can give username and pass and a button which starts the function checklogin(event). All the code in this function works, except the pnlmonbeheer.visible=true., because when you log in successful and you go back to the base state and you then go to the ‘statetoeristingelogd’ state, the panel is still not visible. Here the code:

       

      private function checklogin(evt:ResultEvent):void

                        {

                              if(evt.result.loginsuccess == "yes")

                              {

                              _user = this.username.text;

                              currentState = "";

                              this.lblwelkom.text="Welkom " + _user;

                              pnlmonbeheer.visible=true;

                              }

                              if(evt.result.loginsuccess == "no")

                              {

                              mx.controls.Alert.show("Invalid username/password");

                              }          

                        }

       

       

       

      The other button on the base state leads you to the state ‘statetoeristingelogd’. The panel ‘pnlmonbeheer’ that I want to make visible is on this state and is set invisible because of visible=”false”.

       

      <mx:State name="statetoeristingelogd" basedOn="statetoerist">

                        <mx:RemoveChild target="{button3}"/>

                        <mx:AddChild relativeTo="{panel2}" position="lastChild">

                              <mx:Panel  visible="false" x="0" y="348" width="250" height="111" layout="absolute" title="Beheer Monumenten" borderColor="#DEE438" backgroundColor="#B9BBBC" backgroundAlpha="0.7" id="pnlmonbeheer">

                                   <mx:Button x="8" y="6" label="Toevoegen" width="115" click="showaddmon();"/>

                                   <mx:Button x="133" y="6" label="Updaten" click="showupdatemon();"/>

                                   <mx:Button x="8" y="39" label="Verwijderen" click="deleteRow();"/>

                              </mx:Panel>

                        </mx:AddChild>

                  ………  

                        ……

       

       

      Somehow the panel stays invisible

      Can someone help me please, thank you in advance..