theDeSilva.com Andrew de Silva

Flex Warning: Unable to bind to property ‘XXX’ on class ‘XXX’

February 4th, 2009 · No Comments · Flex

While working on a new project using Flex and Webservices, I got this annoying message when I’m trying to use dataprovider and custom ItemRenderer

warning: unable to bind to property ‘xxx’ on class ‘xxx’ (class is not an IEventDispatcher)
warning: unable to bind to property ‘xxx’ on class ‘xxx’ (class is not an IEventDispatcher)

This is happening because binding fails when using complex objects  , the compiler doesn’t know what kind of datatype that is being looped in the Repeater class and spits out a warning. Depending on what you are trying to do , sometimes it wont even spit out the data. The quick solution is to extend your class to Object and to make it bindable.

Here’s an example

package com.thedesilva
{
import mx.rpc.soap.types.*;
/**
* Wrapper class for a operation required type
*/
[Bindable]
public class Magazine extends Object
{
/**
* Constructor, initializes the type class
*/
public function Magazine() {}
 
public var id:String;
public var imagename:String;
public var name:String;
}
}
Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit
  • Technorati
  • Facebook
  • Google Bookmarks
  • LinkedIn

Tags: