
179
DEVELOPING
COLDFUSION 9 APPLICATIONS
Building Blocks of ColdFusion Applications
Las
t
upda
te
d 8/5/2010
Creating Flash Remoting elements
Adobe® Flash® applications that use Flash Remoting can easily take advantage of ColdFusion components for business
logic. In a CFC, the cffunction tag names the function and contains the application logic, and the cfreturn tag returns
the result to Flash.
Note:
For ColdFusion component methods to communicate with Flash applications, set the
access
attribute of the
cffunction tag to remote.
For more information on creating CFCs for Flash Remoting, see “
Using Flash with CFCs
” on page 616.
Using asynchronous CFCs
ColdFusion provides an event gateway that lets you send a message to a CFC asynchronously. This gateway lets you
initialize processing by a CFC without waiting for the CFC to complete or return a value. You can use asynchronous
CFCs that use this gateway for the following:
•
Reindexing a Verity collection
•
Logging information
•
Running batch processes
For more information on using asynchronous CFCs, see “
About event gateways
” on page 1254.
Creating ColdFusion components
When you create CFCs, you create methods, which are ColdFusion user-defined functions, in the component page.
You pass data to a method by using parameters. The method then performs the function and, if specified in the
cfreturn
tag, returns data.
You can also define variables in a CFC. Within a CFC, these variables are known as
properties
.
Tags for creating CFCs
You use the following tags to create a CFC. You include these tags on the CFML page that defines the CFC.
Elements of a CFC
A CFC has the following characteristics:
•
It is a single CFML page with a .cfc filename extension. The component name is the same as the filename. For
example, if the file is myComponent.cfc, the component name is myComponent.
•
The page is surrounded by a cfcomponent tag. No code can be outside this tag.
•
The component page defines methods (functions), properties (data), or both. Most CFCs have methods, or
methods and properties, but you can also have a CFC that contains only properties.
Tag
Description
cfcomponent
Contains a component definition; includes attributes for introspection. For more information, see “
Building
ColdFusion components
” on page
180.
cffunction
Defines a component method (function); includes attributes for introspection. For more information, see
“
Defining component methods
” on page
180.
cfargument
Defines a parameter (argument) to a method; includes attributes for introspection. For more information, see
“
Defining and using method parameters
” on page
183.
cfproperty
Defines variables for CFCs that provide web services; also use to document component properties. For more
information, see “
The cfproperty tag
” on page
188.