如果我像这样创建一个对象:
class Foo {
[Bindable] public var property: String;
}
类Foo
有一个隐式事件调度程序来处理属性更改事件。如何在不Foo
显式扩展EventDispatcher
的情况下访问该内容?
答案 0 :(得分:3)
如果将-keep
参数添加到编译行,您将能够看到它生成的内容。但要快速解释它,您可以像处理常规EventDisaptcher
一样处理它。
所以在你的主文件中你可以粘贴它:
function callFirst(event:FlexEvent):void
{
foo.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE,test);
foo.property = 'something';
}
function test(E:Event):void
{
trace (ObjectUtil.toString(E));
}
将打印出来:
(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"