I've run across some peculiar behavior and I am trying to figure out if I should report it and if so, how exactly to explain it. Given these two bits of code:
*TestObject.as:* package { public class TestObject { [Bindable] public var a:uint = 2; [Bindable] public var b:uint = 3; [Bindable] public var x:uint = 1; } } *Main Application:* <?xml version="1.0" encoding="utf-8"?> <Application xmlns="http://www.adobe.com/2006/mxml" > <Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var d:ArrayCollection = new ArrayCollection([ new TestObject, new TestObject, new TestObject ]); ]]> </Script> <List dataProvider="{d}"> <itemRenderer> <Component> <HBox> <Label text="{TestObject(data).a}"/> <Label text="{(data as TestObject).b}"/> <Label text="{(data as TestObject).x}"/> </HBox> </Component> </itemRenderer> </List> <Button click="for each (var o:TestObject in d) { o.x++; o.a++; o.b++ }"/> </Application> If you run this application, you get the following warnings: warning: unable to bind to property 'b' on class 'GenericTest_inlineComponent1' warning: unable to bind to property 'b' on class 'GenericTest_inlineComponent1' warning: unable to bind to property 'b' on class 'GenericTest_inlineComponent1' warning: unable to bind to property 'b' on class 'GenericTest_inlineComponent1' warning: unable to bind to property 'b' on class 'GenericTest_inlineComponent1' warning: unable to bind to property 'b' on class 'GenericTest_inlineComponent1' There's a couple of things that stand out here. First, it doesn't complain about properties "x" or "a". The reason it doesn't complain about property "a" is that I used "TestObject(data).a" instead of "(data as TestObject).a". If you change it to the other way around, you will get a warning on "a" as well. I find this rather bizarre, as I thought there was no functional difference to the two, other than "as" returning null if the object wasn't of the appropriate type rather than just erroring out like straight type coercion does. But type coercion/as are very (ahem) "lightly" documented so I admit I don't know a lot. But I don't think it's because of the null problem, since you can replace it with "TestObject(null).b" and it stops giving the warning. The second weird thing is that it doesn't complain about "x" when using "(data as TestObject).x" like it does with a. As you can see, it's claiming this error is on GenericTest_inlineComponent1. This is significant because it appears that it's instead doing some binding to the "x" property on the item renderer, which is *very* odd. You can try this yourself by changing "x" to other strings. Ones where there is a property of HBox named the same thing won't give you a warning. Others will. Yet for all this griping, it seems the data binding IS working. If you click on the button, you'll see all the labels in the list change as the data is being changed. So, anyone want to shed some light on these two behaviors? -- Jason