3 Replies Latest reply on Jan 24, 2008 8:53 AM by m_hartnett

    Priority in Databinding

    webvalue
      Hi,

      I am using <mx:binding> to bind two text fields A and B toether. However, if B has some text in there, the binding is not working. So I wonder what takes the priority?

      thanks.
        • 1. Re: Priority in Databinding
          m_hartnett Level 3
          Your binding is based on source and destination.

          <mx:Binding source="textFieldA.text" destination="textFieldB.text"/>

          if you set textFieldA.text to a value it should be reflected in textFieldB.
          If you want binding to take place the opposite way then you need another binding tag.

          <mx:Binding source="textFieldB.text" destination="textFieldA.text"/>



          • 2. Re: Priority in Databinding
            webvalue Level 1
            first of all thanks for your help.

            If we have this:

            <mx:Binding source="textFieldA.text" destination="textFieldB.text"/>

            the binding seems not working when textFieldB.text is already given a value like this:

            <mx:Text id="textFieldB" text="some text"/>
            • 3. Re: Priority in Databinding
              m_hartnett Level 3
              See if this helps.

              <?xml version="1.0"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
              creationComplete="init()" layout="absolute">


              <mx:Script><![CDATA[


              public function completeHandler(e: Event):void {


              }
              ]]>
              </mx:Script>
              <mx:Binding source="textFieldA.text" destination="textFieldB.text"/>
              <mx:Label text="textFieldA:" x="28"/>

              <mx:Text text="text from textFieldA" id="textFieldA" x="104"/>
              <mx:Text text="this will be overwritten with textFieldA" id="textFieldB" x="103" y="50"/>

              <mx:Button label="Button" click="textFieldA.text='here is the new text'" x="28" y="109"/>
              <mx:Label text="textFieldB:" x="28" y="50"/>
              </mx:Application>