Data binding is one of the nicest features of components. It allows you to link components together without having to use ActionScript.
To data bind one component to another, you use the Bindings tab in the Component Inspector panel, as shown in Figure 16.8. You select the Add Binding button, and the Add Binding dialog box will appear with a list of all the available data binding values (see Figure 16.9). Next, return to the Component Inspector panel, open the Bindings tab, select your new binding, and click the Bound To field where a magnifying glass will appear. Select the magnifying glass, and the Bound To dialog box will appear (see Figure 16.10), which will allow you to choose which component to bind to as well as which of its binding values.
Figure 16.8. The Binding tab in the Component Inspector.
Figure 16.9. The Add Binding dialog box for choosing which data binding element you want to bind.
Figure 16.10. The Bound To dialog box to choose which data binding element to bind to.
It is difficult to grasp until you do it yourself, so follow these steps to data bind a List component to a TextInput component:
The code creates an array of names, and fills the List component by means of the dataProvider property.
Test the movie, and you will see that when you select a name from the List component, that name appears in the TextInput component automatically.
Data binding is a great way to quickly and easily link different components together to share data. You will see data binding again in Chapter 25, "Web Services and Flash."
Now that you have seen a great deal about the components that come with Flash, it's time to create one.