1 Reply Latest reply on Mar 2, 2008 5:43 PM by

    Binding event sequence?

      I'm trying to setup a bi-directional binding between my model in ActionScript and the mxml view and the event sequence is giving me fits.

      ActionScript snippet (everything in the class is [Bindable]):
      private var theAddress:String = "99 Maple Drive";
      public function set address(anAddress:String):void{
      theAddress = anAddress;
      trace("Setting address: [" + theAddress + "]")
      }
      public function get address():String{
      trace("Getting address: " + theAddress)
      return theAddress;
      }

      The mxml snippet:
      <mx:Binding destination="address.text" source="User.instance.solarLocations.current.address" />
      <mx:Binding source="address.text" destination="User.instance.solarLocations.current.address" />
      <mx:TextInput id="address"/>

      The trace output:
      // Open the title window...
      Getting address: 99 Maple Drive
      Getting address: 99 Maple Drive
      Getting address: 99 Maple Drive
      Setting address: []
      Getting address:
      Getting address:
      Getting address:
      // Type into the address box...
      Setting address: [7]
      Getting address: 7
      Getting address: 7
      Getting address: 7
      Getting address: 7
      Getting address: 7
      // Close window & reopen...
      Setting address: []
      Getting address:
      Getting address:
      Getting address:
      Getting address:

      Is bi-directional binding supposed to work? If so is there anyway to force the model to be the master?