Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 623

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
package utils;
public class UIComponents
{
public UIComponents()
{
}
public String sayHello()
{
return "Hello";
}
}
Note: You cannot call constructors with Flash Remoting. Use the default constructor.
In ActionScript, the following
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,
utils.UIComponents",
null,
null );
// Call the service sayHello() method
var pc:PendingCall = javaService.sayHello();
// Tell the service what methods handle result and fault conditions
pc.responder = new RelayResponder( this, "sayHello_Result", "sayHello_Fault" );
function sayHello_Result(re:ResultEvent)
{
// Display successful result
trace("Result is: " + re.result);
}
function sayHello_Fault(fe:FaultEvent)
{
// Display fault returned from service
trace("Error is: " + fe.fault.description);
}
Note: For more information about using Java objects with ColdFusion, see
Handling errors with ColdFusion and Flash
To help with debugging, use
to Flash Player. For example, the ColdFusion page, causeError.cfm, contains the code:
<cftry>
<cfset dev = Val(0)>
<cfset Flash.Result = (1 / dev)>
<cfcatch type = "any">
<cfthrow message = "An error occurred in this service: #cfcatch.message#">
</cfcatch>
</cftry>
call runs the
javaService
and
tags in your ColdFusion page or component to return error messages
cftry
cfcatch
Last updated 1/20/2012
public method of the
sayHello
"Using Java
class:
utils.UIComponents
objects" on page 1135
618

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents