When I started building apps with Flex 2, i found i had a problem with my list controls. To be honest I just assumed it was a bug. Whenever i returned an array of objects from a ColdFusion Component to my Flex 2 app, I found the visual activity of my list didnt work quite right. What I mean is that the mouse over and selected visual highlights didnt happen.

I started to do a little bit of research and found that your new AS objects (which the AMF gateway translates from your CFC’s) need to implement the IUID interface so that the listBased control can tell the items apart. implementing the IUID interface fixed my visual problems completely.

But once I had done that I found I was unable to pass my AS objects back to CF and have them be correctly recognized. In looking at the debug info from CF I saw that once I had implemented that interface my object had a new property. the “mx_internal_uid” property. In order for CF to translate your CFC to their AS counterparts you must use cfproperty to define the instance vars of your object, as well as define all your instance vars in your AS object. And the 2 sets of properties must be in the same order. So I added the mx_internal_uid to both my Objects, but this didnt have any effect on my problem.

In working a bit further I found that if I removed the interface but left the new vars everything worked fine. So it appears by implementing the interface the CF AMF gateway is not able to get the type for the object correctly anymore.

After asking around about this for a bit, i found a work around. Although implementing the IUID interface is the correct method for making the lists work, there is another solution. After talking about my problem with Darron Schall, he asked what happened if I removed my interface in the AS object, but implemented the class as “dynamic”. I made this change and found that everything worked great. I removed my extra properties I had added for the interface, and found that everything still works fine.

Defining the AS object as dynamic allows properties to be added to the object at run time. This allows the list dataprovider to add the uid property without messing up whatever signature cf uses to identify what object is being passes to the gateway.

If you have a solution for implementing IUID without breaking the amf gateway I would love to hear it. But for others running into this problem, here is a solution :)