Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 661

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
serviceObject.execute()
If the action succeeds, the server returns the result. If there is an exception, it returns the fault. Handle the
5
and
ResultEvent
FaultEvent
the service tag, or in global handlers that you specify in the <cf:config>. The ResultEvent object contains the URL
of the File on which the operations have been performed. Users can save this file by downloading it on their
machine or rendering it in the application. The FaultEvent object contains the exception details that occurred on
the server while performing the operation.
For granular control over proxy classes, you can get hold of the underlying RemotObject by using getRemoteObject()
method on the proxy class object. For example, for <cf:Mail id="mailId">, you can get it using the following code in
ActionScript.
var mailobject:RemoteObject = mailId.getRemoteObject();
Using the Mail class
The Mail class is the proxy for the ColdFusion Mail service, which provides the functionality of the cfmail tag. You
specify the required cfmail and child tag attributes for the action as Mail tag attributes. The default Mail action on this
tag is
.
send
The following AIR application uses the Mail Service and file upload functionality. It refers to the CFCredentials.mxml
file to reference the credentials of the user for authentication.
Following is the CFCredentials.mxml file being used for the example:
<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" currentState="collapsed" toolTip="Double
Click to Collapse/Expand" creationComplete="retrieveCredential()" headerHeight="5"
layout="vertical" mouseDown="check Collapse(event )" resizeEffect="Resize">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.http.HTTPService
import mx.rpc.events.Result Event;
import mx.rpc.events.FaultEvent;
import flash.data.EncryptedLocalStore;
import flash.utils.ByteArray;
public var service:HTTPService = new HTTPService();
private function testConnection () :void
{
var CF_HTTP URL:String;
if(cfip.text == null)
{
Alert.show("IP Not provided or Invalid IP Address");
}
else if(cfprt.text!= "" && cfcnxtrt.text != "")
{CF_HTTPURL="http://"+cfip.text+":"+cfprt. text+"/"
+cfcnxtrt.text+"/flex2gateway/";
}
else if(cf prt.text == "" && cfcnxtrt.text == "")
{
CF_HTTPURL ="http://"+cfip.text+"/flex2gateway/";
}
else if(cf prt.text!= "" && cfcnxtrt.text == "")
{
CF_HTTPURL="http://"+cf ip.text+":"+cfprt.text+"/flex2gateway/";
objects in the service-specific result handler and fault handler that you specify in
Last updated 1/20/2012
656

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents