warning: unable to bind to property '' on class 'Object' (class is not an IEventDispatcher)
2007-07-26 10:33
537 查看
这个是在bindable经常会碰到的警告,虽然是警告.但也要弄清楚.
These warnings are there because if you have some code that modifies the individual fields of selectedItem, the binding mechanism will not be able to detect them. A better way to write this would be to create separate variables for the two values:
<?xml version="1.0"?>
<!-- Simple example to demonstrate the ComboBox control. --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Bindable]
public var cards: Array = [ {label:"Visa", data:1},
{label:"MasterCard", data:2}, {label:"American Express", data:3} ];
[Bindable]
public var selectedItemLabel:String = "";
[Bindable]
public var selectedItemData:String = "";
private function closeHandler(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="{cards}" width="150"
close="closeHandler(event);"/>
<mx:VBox width="250">
<mx:Text width="200" color="blue" text="Select a type of credit card."/>
<mx:Label text="You selected: {selectedItemLabel}"/>
<mx:Label text="Data: {selectedItemData}"/>
</mx:VBox>
</mx:Panel>
</mx:Application>
These warnings are there because if you have some code that modifies the individual fields of selectedItem, the binding mechanism will not be able to detect them. A better way to write this would be to create separate variables for the two values:
<?xml version="1.0"?>
<!-- Simple example to demonstrate the ComboBox control. --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Bindable]
public var cards: Array = [ {label:"Visa", data:1},
{label:"MasterCard", data:2}, {label:"American Express", data:3} ];
[Bindable]
public var selectedItemLabel:String = "";
[Bindable]
public var selectedItemData:String = "";
private function closeHandler(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="{cards}" width="150"
close="closeHandler(event);"/>
<mx:VBox width="250">
<mx:Text width="200" color="blue" text="Select a type of credit card."/>
<mx:Label text="You selected: {selectedItemLabel}"/>
<mx:Label text="Data: {selectedItemData}"/>
</mx:VBox>
</mx:Panel>
</mx:Application>
相关文章推荐
- 解决此类问题:warning: unable to bind to property '' on class 'Object' (class is not an IEventDispatcher) .
- warning: unable to bind to property '' on class 'Object' (class is not an IEventDispatcher)
- unable to bind to property 'money' on class 'Object' (class is not an IEventDispatcher)
- warning: unable to bind to property '' on class '' (class is not an IEventDispatcher)
- Flex warning: unable to bind to property 'name' on class 'Object' (class is not an IEventDispatcher)
- 问题:Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath.Perhaps JAVA_HOME does not point to the JDK
- 解决com.sun.tools.javac.Main is not on the classpath / Unable to find a javac compiler 的问题
- Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK(转
- unable to find javac compiler;com.sun.tools.javac.Mainisnotontheclasspath的问题的解决
- Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath.Perhaps JAVA_HOME
- Warning: array_merge() [function.array-merge]: Argument #2 is not an array in e\\class\\functions.php on line 2193
- Python 出现错误 SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform.
- Access restriction: The method typeNameToClass(String) from the type ObjectHandler is not accessible due to restriction on required library
- Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath.Perhaps JAVA_HOME does not point to the JDK
- Warning: Attempt to present on whose view is not in模态跳转问题
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- object is not an instance of declaring class
- 对Warning: Attempt to present XXX on XXX whose view is not in the window hierarchy!的解决方案
- (转)Android Studio解决unspecified on project app resolves to an APK archive which is not supported
- php Warning: date(): It is not safe to rely on the system's timezone settings.