Adobe COLDFUSION 9 Manual page 622

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
import mx.remoting.*;
import mx.services.Log;
import mx.rpc.*;
// Connect to the Flash component service and create service object
var CFCService:Service = new Service(
"http://localhost/flashservices/gateway",
null,
"helloExamples.flashComponent",
null,
null );
// Call the service helloWorld() method
var pc:PendingCall = CFCService.helloWorld();
// Tell the service what methods handle result and fault conditions
pc.responder = new RelayResponder( this, "helloWorld_Result", "helloWorld_Fault" );
function helloWorld_Result(re:ResultEvent)
{
// Display successful result
messageDisplay.text = re.result.HELLOMESSAGE;
timeDisplay.text = re.result.TIMEVAR;
}
function helloWorld_Fault(fe:FaultEvent)
{
// Display fault returned from service
messageDisplay.text = fe.fault;
}
In this example, the
CFCService
Calling the
function in this example executes the function that is defined in
helloWorld
For ColdFusion components, the component filename, including the directory structure from the web root, serves as
the service name. Remember to delimit the path directories with periods rather than backslashes.
Using the Flash Remoting service with ColdFusion Java objects
You can run various kinds of Java objects with ColdFusion, including JavaBeans, Java classes, and Enterprise
JavaBeans. You can use the ColdFusion Administrator to add additional directories to the classpath.
Add a directory to ColdFusion classpath
Open the ColdFusion Administrator.
1
In the Server Settings menu, click the Java and JVM link.
2
3
Add your directory to the Class Path form field.
Click Submit Changes.
4
Restart ColdFusion.
5
When you place your Java files in the classpath, the public methods of the class instance are available to your SWF
movie.
For example, assume the Java class
file contains the following code:
object references the
flashComponent
exists in a directory in your ColdFusion classpath. The Java
utils.UIComponents
Last updated 8/5/2010
component in the helloExamples directory.
flashComponent
617
.

Advertisement

Table of Contents
loading

Table of Contents