PDA

View Full Version : unable to bind to property


evilstrike
07-10-2007, 03:46 PM
Hi, Im getting the following warning when running my Flex application

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


What I have is a flex TileList control that I use to create a thumbnail gallery with pictures located on a remote server via HTTP. I created a thumbnail component called thumbnail.mxml (i used this from an example in the Adobe Livedocs)

thumbnail.mxml

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Image id="image" source="{data.image}"/>
<mx:Label text="{data.caption}"/>
</mx:VBox>



Here is the code from my main gallery where I declare "thumbs" as being an ArrayCollection. And my TileList uses "thumbs" as its dataprovider and "thumbnail" as its ItemRenderer.

gallery.mxml

<mx:Script>
<![CDATA[
[Bindable] public var thumbs:ArrayCollection = new ArrayCollection();
]]>
</mx:Script>

<mx:TileList id="myList" dataProvider="{thumbs}"
itemRenderer="thumbnail" >
</mx:TileList >


And here is what I used to populate the "thumbs" array with values taken from my database via AMFPHP

thumbs.addItem({image:path,
caption:caption,
artist:artist,
nbh:nbh,
parent:parent,
type:type,
date_taken:date_taken,
date_uploaded:date_uploaded,
desc:desc,
literal:literal,
symbolic:symbolic,
metaphore:metaphore
});


The whole code works and the pictures and data showup nicely in the TileList but for each generated thumbnail I get the warning mentionned above and im not sure at all what it means and if I can fix it. The reason I ask this is because I find the rendering to be a bit slow and I thought that this warning might have something to do with it.

codelinker
07-10-2007, 04:30 PM
have you checked for "[Bindable]" for all properties you are binding

dr_zeus
07-10-2007, 05:13 PM
In your call to addItem() you send in a plain Object. The compiler is complaining because Objects aren't EventDispatchers, so changes to the image property of that object will not be detected to update the bindings. If you don't expect those images to change at runtime, then don't worry about the warning.