Prev | Current Page 109 | Next

LordAlex Leon, Greg Goralski

"Foundation Flex for Designers"

So if we had not
included a parameter in our close() method??™s signature of type Event, when someone clicked our
button it would throw an error. An event can trigger more than one method.
149
ACTIONSCRIPT IN FLEX
Binding data
Most applications will rely on one form of data or another. This may take the form of a list of names
of images, or the options in a combo box. In Flex one of them is the dataProvider.
In Flex, a data structure that contains data required by a component or control is referred to as a
dataProvider. Many Flex components have a property called DataProvider. This property generally
takes in some form of complex data, such as an array. For example, say we wanted to use an array to
populate a combo box. We could set that array to be the dataProvider for our ComboBox. Figure 7-26
shows how this would look in the Source view. Note that the name of the dataProvider is placed in
curly brackets in the dataProvider field.
Figure 7-26. ComboBox with an array as a dataProvider
We use the curly brackets to tell Flex we want to bind a certain value to a component control. In our
example, we are binding the array myPictures to the ComboBox. Once the binding is created, if we
dynamically change the value of one of the pictures in the array, the ComboBox will be immediately
updated as well. This is the magic of data binding.
The last ingredient involved in binding a variable to a component is the keyword [Bindable]. We
place it above the value we want to bind; otherwise the binding will not work.


Pages:
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
pustaki szklane House Extension Kąty Rybackie noclegi kasyno Kołobrzeg