Warning Unable to bind to Property "somevar" on object 'Object' class is not an IEventDispatcher
I saw this message in my console while developing a flex application with Cairngorm.
Problem
I'm using the more "generic" object class when returning results from the Cairngorm Service.
The results contain data which is bound to a TileList component. In the TileList is a custom item renderer,
I'm using to display an image.
Solution
Cast the data in your itemrenderer as an objectProxy.
photoRenderer.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
verticalScrollPolicy="off"
horizontalScrollPolicy="off"
creationComplete="init();">
<mx:Script>
<![CDATA[
import mx.utils.ObjectProxy;
[Bindable]
public var
dataProxy:ObjectProxy;
private function init():void {
dataProxy = new ObjectProxy(data);
}
]]>
</mx:Script>
<mx:Image source="{dataProxy.image}" height="65" />
</mx:HBox>
Happy Coding....
If you're binding data to image, the solution it's already posted here :)
If you wanna bind text (coming from XML for example), here is a sample:
...
<Label text="{XML(data).@text}" />
...
- Hope it helps you save some hours of headache :)
I'm sorry, i don't have an answer for Flex 4. I know the List component changed a lot in Flex 4, but I'm unsure how this would impact the use of ObjectProxy.