Flex what is bindable
When you use the [Bindable] metadata tag before a class declaration, it marks all the public properties and all the getter and setter pairs as data-binding-enabled:. When you use [Bindable] before a property declaration, it sets just that property as data-binding-enabled:. If a getter and setter have the same name, you must place the [Bindable] metadata tag before only one of them. If you have only a getter method, the method works only as the source for data binding.
If you have only a setter method, the method works only as the destination for data binding:. Add direct support of property change event bindings, and it's a beautiful thing. Example 3: You have a Page object that manages the details of paginating a set of data, and you need some controls to navigate between the pages as well as display what page you are on. You create a Page object:. A page has a page number, a page size, and the total size of the data set used to tell whether a page exists.
I instantiate a Page object:. Here, the label binds to 2 properties: from and to. Let's implement these properties:. Notice the get syntax: this in ActionScript turns the function into a getter for a property of the same name. Also notice that I made these properties bindable. Next, I need the previous and next buttons. I choose to sandwich the label in between them:. Clicking on P revious will call the prev method and clicking on Next will call the next method.
Here is the code:. Use custom function during data binding Use data binding to make your chart reflect data changes in real time. Value With Data Binding Set the enabled property by using data binding Using Timer to fire data binding event MXML binding Binding control property to a property of another control More Uses for Curly Braces Using more than one set of curly braces Binding With Curly Braces Binding a source property to more than one destination property Defining bidirectional bindings Bind with Binding tag Converting text to upper with Binding Use a static constant as the source for a data-binding expression Create a String variable for binding Multiple Destinations binding Multilevel Bindings Simple Binding Test Using Binding Tag Create a Bidirectional Binding Create a Bidirectional Binding with Binding tag Bind to a Property with Binding tag Property Binding Bind to a Property Using functions that take bindable properties as arguments Use Bindable Property Chains Bind to a Function
0コメント