I have some confusion on what we call “binding” as ?
Is it :
1) Change in [Bindable] Model which leads to an automatic change in View ( bound to that model )
OR
2) Change in View and then an automatic change in the [Bindable] Model ( the View is bound with )
Thanks
The typical use of data binding in Flex is to bind some model object to a view object (#1).
In Flex 4, two way binding was introduced. This does both #1 and #2. That is any change made in the model is reflected in the view. But also, any change made to the value in the view updates the model value.
To use two way binding, add the @ symbol to the binding expression in the view:
Note that when you make something Bindable, the mxml compiler generates a setter method for your Bindable variable, which dispatches an event anytime the variable changes. The mxml compiler then adds event listeners for this event to the view objects that are bound to the variable. So technically, any object (whether it is a view, model, controller, or something else) can be bound to a variable, as long as it can receive the event.