Friday, March 27, 2009

Explain how binding works in mxml components.

Question :Explain how binding works in mxml components.
Answer :Binding in MXML
Lets look at the following code…


Here you are binding the text property of the TextInput to the label. So whatever you type in the
textInput automatically reflects in the label. That’s the power of Binding…
The best practice for defining components that return information back to the main application is to
design the component to dispatch an event that contains the return data. In that way, the main
application can define an event listener to handle the event and take the appropriate action. You also
use events in data binding. The following example uses the Bindable metadata tag to make
useShortNames a bindable property. The implicit setter for the useShortNames property dispatches
the change event that is used internally by the Flex framework to make data binding work.

No comments: