unable to bind to property 'money' on class 'Object' (class is not an IEventDispatcher)

来源:互联网 发布:淘宝运动鞋店铺 编辑:程序博客网 时间:2024/06/13 00:14

Flex warning: unable to bind to property 'money' on class 'Object' (class is not an IEventDispatcher)




当绑定Object数据到组件时,可能会出现这样的错误

warning: unable to bind to property 'money' on class 'Object' (class is not an IEventDispatcher)

 

遇到这种情况原因时Object不具备抛出改变事件的能力,此时需要ObjectProxy 代理取代Object。代码如下:

 

//如果你这么写,会报警告

[Bindable]

private var data:Object= {id:1,title:"你好"};

 

 

//应该这样

private var data:Object= {id:1,title:"你好"};

 

[Bindable]

private var dataProxy:ObjectProxy = new ObjectProxy(data);

0 0
原创粉丝点击