If I create an object like so:
class Foo {
[Bindable] public var property: String;
}
The class Foo
has an implicit event dispatcher to handle property change events. How can开发者_如何学Python I access that without making Foo
explicitly extend EventDispatcher
?
If you add the -keep
parameter to your compile line you will be able to see what it generates. But to explain it quickly you can just handle it like it would be a regular EventDisaptcher
.
So in your main file you can paste this:
function callFirst(event:FlexEvent):void
{
foo.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE,test);
foo.property = 'something';
}
function test(E:Event):void
{
trace (ObjectUtil.toString(E));
}
Will print out:
(mx.events::PropertyChangeEvent)#0
bubbles = false
cancelable = false
currentTarget = (Foo)#1
property = "something"
eventPhase = 2
kind = "update"
newValue = "something"
oldValue = (null)
property = "property"
source = (Foo)#1
target = (Foo)#1
type = "propertyChange"
精彩评论