2 Replies Latest reply on Oct 28, 2009 7:16 AM by salfhhhhhg

    ResourceManager and states


      Hi every body,


           I have got simple login form with one state after clicking "I forgot the password". I use databinding to ResourceManager in a base state and in 'Remind' state with the same controls. Everything works fine, when i change language in a base state, then in 'Remind' state every label is in chosen language. But when I change language in 'Remind' state, then in that state i see labels from a base state and after return to the base state there are obsolete labels. The problem doesn't exist according to LinkButton so i think the workaround would be by creating new controls for a state instead of switching bindings, but i would like to know what's happening here? Any help appreciated.. Here's the form and log of changing language in the 'Remind' state from BindingManager (same as in base state):


      <mx:FormItem id="fiLogin" label="{resourceManager.getString('myResources', 'loginBox.loginLabel')}" required="true" width="100%">
              <mx:TextInput id="loginTxt" width="100" />
          <mx:FormItem id="fiPass" label="{resourceManager.getString('myResources', 'loginBox.passLabel')}" required="true" width="100%">
              <mx:TextInput id="passTxt" width="100" />
              <mx:FormItem direction="horizontal">
              <mx:Button id="btnLogin" label="{resourceManager.getString('myResources', 'loginBox.loginButton')}" click="doLogin(event)"/>
          <mx:LinkButton id="lbPassForgot" label="{resourceManager.getString('myResources', 'loginBox.passForgot')}" click="currentState='stateForgotPass'"/>
              <mx:State name="stateForgotPass" >
                  <mx:SetProperty target="{fiPass}" name="label" value="{resourceManager.getString('myResources', 'loginBox.email')}"/>
                  <mx:SetProperty target="{btnLogin}" name="label" value="{resourceManager.getString('myResources', 'loginBox.remind')}"/>
                  <mx:SetProperty target="{this}" name="title" value="{resourceManager.getString('myResources', 'loginBox.remind')}"/>
                  <mx:SetProperty target="{lbPassForgot}" name="visible" value="false"/>
                  <mx:SetEventHandler target="{btnLogin}" name="click" handlerFunction="doRemind"/>




      Binding: destString = this.title, srcFunc result = Login
      Binding: destString = fiLogin.label, srcFunc result = Login:
      Binding: destString = fiPass.label, srcFunc result = Password:
      Binding: destString = btnLogin.label, srcFunc result = Login
      Binding: destString = lbPassForgot.label, srcFunc result = I forgot the password
      Binding: destString = _LoginBox_SetProperty1.value, srcFunc result = E-mail:
      Binding: destString = _LoginBox_SetProperty2.value, srcFunc result = Remind
      Binding: destString = _LoginBox_SetProperty3.value, srcFunc result = Remind

        • 1. Re: ResourceManager and states
          Flex harUI Adobe Employee

          I think I might create a string library and have components bind to it.  You want to try to not use resourceManager bindings in the state definition.


          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          1 person found this helpful
          • 2. Re: ResourceManager and states
            salfhhhhhg Level 1

            Hi, thanks for the reply. I created second form and on state change switch visibility an includeInLayout form first to second and works good. There was a problem with Panel title, but on state change I simply bind different strings to it. I put it here in case someone need it. Looking forward to see a solution of the problem from Adobe. Greetz.


                     private function bindNewTitle():void{
                         BindingUtils.bindProperty(this, "title",
                                {    name: "getString",
                                    getter: function(resMan:IResourceManager):String {
                                                return resMan.getString("myResources", "loginBox.remind");