MACROMEDIA FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Uživatelský manuál Strana 107

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 184
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 106
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;
}
Zobrazit stránku 106
1 2 ... 102 103 104 105 106 107 108 109 110 111 112 ... 183 184

Komentáře k této Příručce

Žádné komentáře