
Ok, so I was pulling my hair out last night trying to figure out why the value object that ColdFusion was returning was not casting to the value object on the Flex/Actionscript side.
I bet I ran the Flex debugger 100 times. Everything looked just fine. The object that was being returned from ColdFusion was typed correctly and had the correct data, but when I went to assign the object to the proper type in Flex, it would end up being null.
After a few hours of this, I decided to open a bottle of wine and call it a night. Nothing like a well rested pair of eyes to solve the problem.
After having no luck this morning, I had my friend, Kevin Kazmierczack take a look at my VO on the Flex side of things.
Before:
[RemoteClass(alias="openmetric.com.openmetric.cfc.vo.OpenMetricEventVO")]
import com.openmetric.as3.model.vo.OpenMetricEventTypeVO;
[Bindable]
public class OpenMetricEventVO
...
Kevin suggested moving the import statement above the meta data for the RemoteClass. Shazaam! It worked.
Now, I don't know if I'm just dumb and I missed this in Flex 101 and need to go back, or if this is just something you have to find out the hard way. I'm guessing it's the former, but who knows. However, swapping those two little lines of code to this made all my headaches go away:
After:
import com.openmetric.as3.model.vo.OpenMetricEventTypeVO;
[RemoteClass(alias="openmetric.com.openmetric.cfc.vo.OpenMetricEventVO")]
[Bindable]
public class OpenMetricEventVO
...
Anyone else ever run into this?