Two-way Data Binding in Flex 4

Categories: flex
Written By: sebi

Some new specification details were added to the Flex 4 SDK about the bi-directional databinding.I was always wondering, why the databinding needs so strange structures to work in both directions, the syntax wasn’t obvious . I remember the first time I tried to use it, and I remember too, when I first tried to explain to my colleague.

“So you bind this to that, and it works…”, “Hm, it doesn’t write back the changes”, “Oh, well, then you need an additional tag, like this”, “Pfff, bah, how did you find that..”

To bind back the changed property to the original collection we had to add the following line, the tag.

Now it will be much easier - if the syntax still looks strange:

Note the @ sign before the expression. Or with only the binding tag: Old syntax:

New one:

Handy.

Via Peter deHaan at http://opensource.adobe.com/wiki/display/flexsdk/Two-way+Data+Binding

Comments are closed.