Data binding (usually done using {} in mxml) is one of the best features in Flex. It simplifies a lot of coding. Underneath the hood, Flex actually generates a lot of code to handle the data binding.
Note:
You can skip the rest of this article and just read Chapter 40 of the Flex Developer Guide.
The easiest way to do data binding is {} in mxml. It is so easy to use and so easy to understand that it is like magic. However, one often has questions about what can or cannot be put into the {}. Object properties (eg. object1.abc) are definitely allowed. Chains like object1.subobj.subsubobj.subsubsubobj.property are also allowed. Is functions allowed? Is array allowed? The best source is chapter 40 of the Flex Developer Guide.
To debug {} bindings, see Debugging bindings section in andybryant's blog:
Data binding can be done in many ways:
- {} in mxml
- <mx:Binding> tag in mxml
- BindingUtils class
- ChangeWatcher class
- good old event listener