3 Replies Latest reply on Oct 6, 2010 5:46 PM by Flex harUI

    Problema com Id's

    giba_f Level 1

      Ola a todos !!!

       

      no bloco abaixo, eu quero usar o Panel onde esta comentado (EU QUERO DEIXAR AKI), mas dah erro nos id nas LoginUsuEnt() e a LoginUsuEnt().

       

      Se alguem puder me ajudar, fico muito agradecido..

       

      Obrigado

       

      Gilberto

       

      <mx:Application>
          <mx:ApplicationControlBar>
              <mx:Canvas>
                  <mx:Image/>

       

                      <!-- EU QUERO DEIXAR AKI
                      <mx:Panel>
                          <mx:Label     id="SayLogin0"  x="1"   y="1"   text="Login:"/>
                          <mx:TextInput id="GetLogin0"  x="4"   y="16"  width="113"/>
                          <mx:Label     id="SaySenha0"  x="122" y="1"   text="Senha:"/>
                          <mx:TextInput id="GetSenha0"  x="125" y="16"  width="97" displayAsPassword="true" />
                          <mx:Button    id="ButLgnCon0" x="4"   y="42"  width="51" label="OK" click="LoginUsu()"/>
                          <mx:Button    id="ButLgnDad0" x="63"  y="42" label="Esqueci os meus Dados" width="160"/>
                      </mx:Panel>
                      -->

       

                  <mx:Label/>
              </mx:Canvas>
          </mx:ApplicationControlBar>

          <mx:HBox >
              <mx:Panel>
                  <mx:TabNavigator>
                      <mx:VBox>
                          <mx:Tree/>
                          <mx:Spacer/>
                          <mx:Canvas>

       

                              <!-- EU NAO QUERO QUERO DEIXAR AKI, E SIM, LAH EM CIMA -->
                               <mx:Panel>
                                  <mx:Label     id="SayLogin0"  x="1"   y="1"   text="Login:"/>
                                  <mx:TextInput id="GetLogin0"  x="4"   y="16"  width="113"/>
                                  <mx:Label     id="SaySenha0"  x="122" y="1"   text="Senha:"/>
                                  <mx:TextInput id="GetSenha0"  x="125" y="16"  width="97" displayAsPassword="true" />
                                  <mx:Button    id="ButLgnCon0" x="4"   y="42"  width="51" label="OK" click="LoginUsu()"/>
                                  <mx:Button    id="ButLgnDad0" x="63"  y="42" label="Esqueci os meus Dados" width="160"/>
                              </mx:Panel>

       

                          </mx:Canvas>
                  </mx:TabNavigator>
              </mx:Panel>
          </mx:HBox >


          <mx:Script>
              <![CDATA[

       

                  [Bindable]
                  public var cCodUsu:String = "" ;
                  public var cNomUsu:String = "" ;
                  public var lLogin:Boolean = false;


                  private function LoginUsu():void {
                      if ( lLogin == false )
                          LoginUsuEnt();
                      else
                          LoginUsuSai();  
                  }

                  private function LoginUsuEnt():void {
                      lLogin = true;
                      if ( lLogin == true ) {
                          cCodUsu = "00001" ;
                          cNomUsu = "FULANO DE TAL";
                          SayLogin.text = "Nome";
                          SaySenha.visible = false;
                          GetLogin.text = wNomUsu;
                          GetLogin.width = 220;
                          GetLogin.editable = false;     
                          GetSenha.visible  = false;
                          ButLgnDad.visible = false;
                          ButLgnCon.label = "Sair";
                          ButLgnCon.width = 80;
                          ButLgnCon.x = 80;
                      }
                  }

                  private function LoginUsuSai():void {
                      lLogin = false;
                      wCodUsu = "" ;
                      wNomUsu = "";
                      SayLogin.text = "Login:"
                      GetLogin.text = "";
                      GetLogin.width=113
                      GetLogin.editable = true;
                      SaySenha.visible  = true;
                      GetSenha.visible  = true;
                      ButLgnDad.visible = true;
                      ButLgnCon.label = "Ok";
                      ButLgnCon.x = 4;
                      ButLgnCon.width = 51;
                  }
                 
              ]]>
          </mx:Script>
      </mx:Application>

        • 1. Re: Problema com Id's
          Flex harUI Adobe Employee

          Not sure, but I think you want to put the panel in an MXML Component

          (separate MXML file) and use that twice.

          1 person found this helpful
          • 2. Re: Problema com Id's
            giba_f Level 1

            no..sorry.. I trying traslation:

             

            Hello everyone!


            in the block below, I want to uso the Panel where it commented (I WANT TO LEAVE HERE), but there errors in ID'S in the LoginUsuEnt() and in the LoginUsuEnt()

             

            If someone can help me, I am very grateful ..



             

            Thank you very much.

             

            Gilberto

             

             

            <mx:Application>
                <mx:ApplicationControlBar>
                    <mx:Canvas>
                        <mx:Image/>

             

                            <!-- I WANT TO LEAVE HERE
                            <mx:Panel>
                                <mx:Label     id="SayLogin0"  x="1"   y="1"   text="Login:"/>
                                <mx:TextInput id="GetLogin0"  x="4"   y="16"  width="113"/>
                                <mx:Label     id="SaySenha0"  x="122" y="1"   text="Senha:"/>
                                <mx:TextInput id="GetSenha0"  x="125" y="16"  width="97" displayAsPassword="true" />
                                <mx:Button    id="ButLgnCon0" x="4"   y="42"  width="51" label="OK" click="LoginUsu()"/>
                                <mx:Button    id="ButLgnDad0" x="63"  y="42" label="Esqueci os meus Dados" width="160"/>
                            </mx:Panel>
                            -->

             

                        <mx:Label/>
                    </mx:Canvas>
                </mx:ApplicationControlBar>

                <mx:HBox >
                    <mx:Panel>
                        <mx:TabNavigator>
                            <mx:VBox>
                                <mx:Tree/>
                                <mx:Spacer/>
                                <mx:Canvas>

             

                                    <!-- I NOT WANT TO LEAVE HERE, AND YES THERE OVER -->
                                     <mx:Panel>
                                        <mx:Label     id="SayLogin0"  x="1"   y="1"   text="Login:"/>
                                        <mx:TextInput id="GetLogin0"  x="4"   y="16"  width="113"/>
                                        <mx:Label     id="SaySenha0"  x="122" y="1"   text="Senha:"/>
                                        <mx:TextInput id="GetSenha0"  x="125" y="16"  width="97" displayAsPassword="true" />
                                        <mx:Button    id="ButLgnCon0" x="4"   y="42"  width="51" label="OK" click="LoginUsu()"/>
                                        <mx:Button    id="ButLgnDad0" x="63"  y="42" label="Esqueci os meus Dados" width="160"/>
                                    </mx:Panel>

             

                                </mx:Canvas>
                        </mx:TabNavigator>
                    </mx:Panel>
                </mx:HBox >


                <mx:Script>
                    <![CDATA[

             

                        [Bindable]
                        public var cCodUsu:String = "" ;
                        public var cNomUsu:String = "" ;
                        public var lLogin:Boolean = false;


                        private function LoginUsu():void {
                            if ( lLogin == false )
                                LoginUsuEnt();
                            else
                                LoginUsuSai();  
                        }

                        private function LoginUsuEnt():void {
                            lLogin = true;
                            if ( lLogin == true ) {
                                cCodUsu = "00001" ;
                                cNomUsu = "FULANO DE TAL";
                                SayLogin.text = "Nome";
                                SaySenha.visible = false;
                                GetLogin.text = wNomUsu;
                                GetLogin.width = 220;
                                GetLogin.editable = false;     
                                GetSenha.visible  = false;
                                ButLgnDad.visible = false;
                                ButLgnCon.label = "Sair";
                                ButLgnCon.width = 80;
                                ButLgnCon.x = 80;
                            }
                        }

                        private function LoginUsuSai():void {
                            lLogin = false;
                            wCodUsu = "" ;
                            wNomUsu = "";
                            SayLogin.text = "Login:"
                            GetLogin.text = "";
                            GetLogin.width=113
                            GetLogin.editable = true;
                            SaySenha.visible  = true;
                            GetSenha.visible  = true;
                            ButLgnDad.visible = true;
                            ButLgnCon.label = "Ok";
                            ButLgnCon.x = 4;
                            ButLgnCon.width = 51;
                        }
                       
                    ]]>
                </mx:Script>
            </mx:Application>

            • 3. Re: Problema com Id's
              Flex harUI Adobe Employee

              I'm still not sure.  You can't use the same id twice in a single MXML file.

              And if you have the same pattern twice, an MXML component is recommended.

              Of course, you can always change one of the sets of ids.

               

              The id's you are using in the methods don't match the ids in the MXML and

              that will also be a problem.