Macromedia flex 2-migrating applications to flex 2 Manual De Usuario

Descargar
Página de 184
Binding from a property
107
The Flex compiler automatically generates an event named 
propertyChange
 for all public 
properties so the properties can be used as the source of a data binding expression. In this case, 
specifying the 
[Bindable]
 metadata tag with no event is the same as specifying the following:
[Bindable(event="propertyChange")]
Binding from a single property
To make a single property usable as the source for a data binding expression, add the 
[Bindable]
 metadata tag before the property declaration. The property can be public, 
protected, or private. 
Flex 1.5:
var foo:String; // You could bind to this in 1.5
Flex 2:
[Bindable]
public var foo:String;
The Flex compiler automatically generates an event named 
propertyChange
 for all public 
properties so the properties can be used as the source of a data binding expression. In this case, 
specifying the 
[Bindable]
 metadata tag with no event is the same as specifying the following:
[Bindable(event="propertyChange")]
Binding from a property defined by a setter and getter 
method
In Flex 1.5, you used the 
[ChangeEvent]
 metadata tag on setter/getter pairs. In Flex 2, you 
replace the 
[ChangeEvent]
 metadata tag with the 
[Bindable]
 metadata tag and dispatch the 
event in the method. This strategy also applies to other methods that dispatched custom 
events.
Flex 1.5:
[ChangeEvent("maxFontSizeChanged")]
// Define public getter method.
public function get maxFontSize():Number {
return _maxFontSize;
}
Flex 2:
[Bindable(event="maxFontSizeChanged")]
// Define public getter method.
public function get maxFontSize():Number {
return _maxFontSize;
}