Hello,
Lets say you have an AS class:
[RemoteClass(alias="MyVO)]
public class MyVO
{
public var name:String;
};
and a corresponding CFC:
<cfcomponent displayname="MyVO">
<cfproperty name="name" type="string" />
<cfset variables._name_str = "" />
<cffunction name="getName" access="public" returntype="string">
<cfreturn variables._name_str />
</cffunction>
<cffunction name="setName" access="public" returntype="void">
<cfargument name="name" type="string" required="true" />
</cffunction>
</cfcomponent>
If you send back an instance of MyVO to flex, the ColdFusion Remoting adapter will automatically serialize is as an object with the classname MyVO. When it reaches Flex (because of the RemoteClass tag) it will be automatically converted to the actionscript version of MyVO.
>do the AS & CFC objects have to match exactly? ie methods too?
There is no need to completely match it, its however good practice to let all properties match.
One warning: When sending stuff from CF to Flex the AMFserializer will not include properties defined in the super cfc's (cfc's that are extended). So you need to include cfproperty tags for all available properties (even the ones that are allready set in the super class).
Hope this helps.
Greetz Erik
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
__,_._,___