您的位置:首页 > 运维架构

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

2009-08-17 15:35 519 查看
早上在编程的时候出现 warning: unable to bind to property '' on class 'Object' (class is not an IEventDispatcher) 这种警告!
这些警告,因为如果你有一些代码,修改了个别领域的selectedItem ,有约束力的机制,将无法探测到它们。一种更好的方式来写这将是建立独立的两个变量的值
比如:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Bindable]
public var arr: Array = [ {label:"a1", data:1}, {label:"a2", data:2}, {label:"a3", data:3} ];
[Bindable]
public var selectedItemLabel:String = "";
[Bindable]
public var selectedItemData:String = "";
private function Handler(event:Event):void
{
selectedItemLabel=ComboBox(event.target).selectedItem.label;
selectedItemData=ComboBox(event.target).selectedItem.data;
}
]]>
</mx:Script>
<mx:Panel title="ComboBox Control Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
<mx:ComboBox dataProvider="{arr}" width="150"
close="Handler(event);"/>
<mx:VBox width="250">
<mx:Text width="200" color="blue" text="selectedItem example!"/>
<mx:Label text="the Selected: {selectedItemLabel}"/>
<mx:Label text="the Data: {selectedItemData}"/>
</mx:VBox>
</mx:Panel>
</mx:Application>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐