Getting a runtime warning message, not sure how to get rid of it

I am getting this runtime warning message:

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

It happens when my datagrid change handler is called, and the code is as follows:

private function dgChangeHandler(event:Event):void
    txtCode.text =;

Whenever I click a selection on the datagrid, that single line in the handler is the one causing the warning message to come up. (txtCode is a mx:TextInput).

Why is this warning coming up, and what can I do to get rid of that warning?
Who is Participating?
I found out what was happening to cause the "unable to bind" warning in the
scenario that I described (see below). I eventually stumbled onto this
solution after trying many different searches in Google:


This is a solution for the common warning: "unable to bind to property 'XXX'
on class 'Object' (class is not an IEventDispatcher)"

This problem occurs frequently when transferring complex objects using AMF
when the object returned from the server contains an array or array
collection of more objects.
One symptom of this problem is that it occurs after converting the data
request from an HTTPService call to a Remote Object call.

It turns out that Flex does not handle data returned from the AMF data
service in quite the same way as HTTPService and WebService results. With
these two later services Flex will automatically wrap Arrays in
ArrayCollection and Objects in ObjectProxy wrappers so binding will work.

The solution is to do this same thing manually, with code similar to the

function resultHandler(result:Array) {
   for(var i:String in result) result[i] = new ObjectProxy(result[i]);
   targetArrayCollection = new ArrayCollection(result);

Note: It may be the case that the result object is already an
ArrayCollection yet the Objects in ObjectProxy wrappers. In this case you
only need to include the for loop to implement ObjectProxy for all objects
in the ArrayCollection.

What the dataProvider for datagrid? Mostly the selectedItem xml( or what ever be the dataProvider) wont be having a child "code" node.

elepilAuthor Commented:
The dataProvider is an ArrayCollection object, and the selectedItem does have a child node "code". In fact, the application works perfectly as expected.

This is not the first time I got this warning message. In fact, I was able to get rid of it when I wrapped objects in ObjectProxy objects by passing the object to the ObjectProxy constructor. But in this case, I can't do that because "code" is of type string, and I don't know how to get rid of it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.