MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Use Manual page 30

Table of Contents

Advertisement

Send a message to ColdFusion
In this section, you create a function to send a message through the Flex Messaging event
gateway to a ColdFusion application. You then create a structure, named msg, that contains
the gateway ID, and the information necessary to send an e-mail message. The gateway ID is
the ID you assign when you create the gateway instance in ColdFusion MX Administrator.
Finally, you send the message to ColdFusion.
Directly below the initApp method, add the following code:
1.
public function sendMessage():void {
var msg:AsyncMessage = new AsyncMessage();
msg.headers.gatewayid = "Flex2CF2";
msg.body = new Object();
msg.body.emailto = emailto.text;
msg.body.emailfrom = emailfrom.text;
msg.body.emailsubject = emailsubject.text;
msg.body.emailmessage = emailmessage.text;
pro.send(msg);
messagestatus.text = "Message sent to ColdFusion.";
}
Save the file.
2.
Receive a message from ColdFusion
In this section, you display a message sent from ColdFusion.
Add the following function after the sendMessage function:
1.
private function messageHandler(event:MessageEvent):void {
messagestatus.text = "Message received from ColdFusion";
}
Save the file as flexemail2cf.mxml. in the
2.
C:\fds2\jrun4\servers\default\samples\dataservice\myapp folder.
30
Use ColdFusion Event Gateway Adapter

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents