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

Table of Contents

Advertisement

Verify that your code is correct
Your code should match the following code example. Verify that the content is correct.
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="initApp()">
<mx:Script>
<![CDATA[
import mx.messaging.events.*;
import mx.messaging.Producer;
import mx.messaging.messages.AsyncMessage;
public var pro:mx.messaging.Producer;
public var con:mx.messaging.Consumer;
public function initApp() {
pro = new mx.messaging.Producer();
pro.destination = "ColdFusionGateway";
consumer.subscribe();
}
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.";
}
private function messageHandler(event:MessageEvent):void {
messagestatus.text = "Message received from ColdFusion.";
}
]]>
</mx:Script>
<mx:Consumer id="consumer" destination="ColdFusionGateway"
message="messageHandler(event)" />
Create the Flex application
31

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents