User Guide

Table Of Contents
Using the Flash Remoting service with ColdFusion Java objects 819
In this example, the CFCService object references the flashComponent component in the
helloExamples directory. Calling the
helloWorld function in this example executes the function
that is defined in
flashComponent.
For ColdFusion components, the component file name, 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 MX, including JavaBeans, Java classes,
and Enterprise JavaBeans. You can use the ColdFusion MX Administrator to add additional
directories to the classpath.
To add a directory to ColdFusion classpath:
1.
Open the ColdFusion MX Administrator.
2.
In the Server Settings menu, click the Java and JVM link.
3.
Add your directory to the Class Path form field.
4.
Click Submit Changes.
5.
Restart ColdFusion.
When you place your Java files in the classpath, the public methods of the class instance are
available to your Flash movie.
For example, assume the Java class
utils.UIComponents exists in a directory in your ColdFusion
classpath. The Java file contains the following code:
package utils;
public class UIComponents
{
public UIComponents()
{
}
public String sayHello()
{
return "Hello";
}
}
Note: You cannot call constructors with Flash Remoting. You must use the default constructor.
In ActionScript, the following javaService call invokes the sayHello public method of the
utils.UIComponents class:
import mx.remoting.*;
import mx.services.Log;
import mx.rpc.*;
// Connect to service and create service object
var javaService:Service = new Service(
"http://localhost/flashservices/gateway",
null,