0 Replies Latest reply on Feb 7, 2008 6:20 AM by gdereck

    Binding e4x XML using BindingUtils

      We have an XML variable, say:

      var myVar:XML = <a><b>whatever</b></a>;

      Can anyone explain why the MXML curly braces syntax works:

      <mx:TextInput id="textInput" text="{myVar.b}"/>

      And seemingly equivalent ActionScript code does not:

      BindingUtils.bindProperty(textInput, "text", myVar, "b")
      BindingUtils.bindProperty(textInput, "text", this, ["myVar", "b"])

      both of the above seem to work fine at first, as they initialize textInput with the value from XML, but later on the changes to myVar.b remain undetected and textInput.text does not change.
      What's the difference between both methods in this case?

      It's worth mentioning that if myVar is an ObjectProxy, such as:

      var myVar:ObjectProxy = new ObjectProxy(<a><b>whatever</b></a>);

      both methods work great. But the changes in the original XML (if passed to ObjectProxy contructor as a variable) wouldn't be detected. They have to be made directly to the proxy properties.