The simple approach for classes to offer databinding enabled properties is to
simply
declard the whole class as [Bindable].
To make full use of the feature instances/references to objects must be
declared as
[Bindable] as well.
Well, since it is said in the documentation to use custom bindings รก la
[Bindable("myPropertyChanged")], i'll implement the properties that way.
When i have, let's say two properties, each having its own metadata tag
declaring the
property as [Bindable], do i have to declare the instances as [Bindable] by
using the
standard tag? Or must i explicitly declare the instance as [Bindable] by using
all custom
tags. It's works with [Bindable], but i'm asking for the clean implementation.
Example:
package {
public class DataBindingExample {
private var _propertyOne:String;
private var _propertyTow:String;
[Bindable("propertyOneChanged")]
public function get propertyOne():String { return this._propertyOne; }
public function set propertyOne(value:String):void {
if (this._propertyOne == value) return;
this._propertyOne = value;
this.dispatchEvent(new Event("propertyOneChanged"));
}
[Bindable("propertyTowChanged")]
public function get propertyTow():String { return this._propertyTow; }
public function set propertyTow(value:String):void {
if (this._propertyTow == value) return;
this._propertyTow = value;
this.dispatchEvent(new Event("propertyTowChanged"));
}
}
}
Do i have to declare it like:
[Bindable]
private var _dbe:DataBindingExample
or:
[Bindable("propertyTowChanged")]
[Bindable("propertyOneChanged")]
private var _dbe:DataBindingExample
?
I'm so curious! Best regards!