An awesome little Flex and CF performance gem popped up on the Transfer list last night. Some of us had been discussing how we return data to Flex from ColdFusion. As I've mentioned before on the blog, I use AOP to translate queries and other data into CFC Value Objects for automatic translation into ActionScript classes. I actually thought this was the only way to get the automatic type conversion.
Well Jon Messer piped up with an alternative technique, and Sean Corfield quickly confirmed that it was an "official" option and not just an undocumented hack! You can actually return an array of structures to Flex. You specify all of the properties as structure keys, but then add a key for "__type__", which specifies the CFC type that you want Flex to "see" the structure as! Full details in, where else, the docs: http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=UseFlexDataService_05.html
End result? For large sets of data, this will definitely be faster than returning arrays of CFC instances. I had never even heard of this option so thanks Jon!