You can use the PropertyChangeEvent on a [Bindable] class to listen for any property changes. As long as you're using the get/set properties.
package
{
[Bindable]
public class Person
{
private var _firstName:String;
private var _lastName:String;
private var _age:Number;
public function get firstName():String
{
return _firstName;
}
public function set firstName(value:String):void
{
_firstName = value;
}
public function get lastName():String
{
return _lastName;
}
public function set lastName(value:String):void
{
_lastName = value;
}
public function get age():Number
{
return _age;
}
public function set age(value:Number):void
{
age = value;
}
public function Person()
{
// empty constructor
}
}
}
Then, in your using class add the event listener.
public var p:Person;
private function addListener():void
{
p = new Person();
p.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, onPropertyChange);
}
private function onPropertyChange(event:PropertyChangeEvent):void
{
trace(event.property + " " + event.kind + " " + event.oldValue + " " + event.newValue);
}