MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Use Manual page 58

Table of Contents

Advertisement

Creating the Value Object CFC
To create the Value Object to return to Flex, you create a CFC by using the
and including get and set methods. The Value Object CFC appears as follows:
<cfcomponent output="false" alias="samples.contact.Contact">
<!--- These are properties that are exposed by this CFC object. --->
<!--- These property definitions are used when calling this CFC --->
<!--- as a web services, passed back to a Flash application, --->
<!--- or when generating documentation. --->
<!--- NOTE: These cfproperty tags do not set any --->
<!--- default property values. --->
<cfproperty name="contactId" type="numeric" default="0">
<cfproperty name="firstName" type="string" default="">
<cfproperty name="lastName" type="string" default="">
<cfproperty name="address" type="string" default="">
<cfproperty name="city" type="string" default="">
<cfproperty name="state" type="string" default="">
<cfproperty name="zip" type="string" default="">
<cfproperty name="phone" type="string" default="">
<cfscript>
//Initialize the CFC with the default properties values.
this.contactId = 0;
this.firstName = "";
this.lastName = "";
this.address = "";
this.city = "";
this.state = "";
this.zip = "";
this.phone = "";
</cfscript>
<cffunction name="init" output="false"
returntype="samples.contact.Contact">
<cfreturn this>
</cffunction>
<cffunction name="getContactId" output="false" access="public"
returntype="any">
<cfreturn this.contactId>
</cffunction>
<cffunction name="setContactId" output="false" access="public"
returntype="void">
<cfargument name="val" required="true">
<cfif (IsNumeric(arguments.val)) OR (arguments.val EQ "")>
<cfset this.ContactId = arguments.val>
<cfelse>
58
Using the Flex Data Service Assembler
tag
cfproperty

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents