
246 Use ColdFusion Event Gateway Adapter
Create the Flex application
The Flex application in this tutorial is a simple form in which you specify the elements of an
e-mail message, including the recipient, the sender, the subject, and the message body.
Create a new MXML file
In this section, you create an MXML file in which the layout of user interface elements is
exactly as you specify them, or absolute.
1. In an MXML editor, create a file that contains the following text:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
layout="absolute"
creationComplete="initApp()">
</mx:Application>
2.
Save the file as flexemail2cf.mxml. in the
C:\fds2\jrun4\servers\default\samples\dataservice\maypp folder.
Create the user interface
In this section, you create the controls to enter information to send an e-mail message:
1. Add the following MXML code after the <mx:Application> tag:
<mx:Consumer id="consumer" destination="ColdFusionGateway"
message="messageHandler(event)"/>
<mx:TextInput x="103" y="13" width="291" id="emailto" editable="true"/>
<mx:TextInput x="103" y="43" width="291" id="emailfrom" editable="true"/
>
<mx:TextInput x="103" y="73" width="291" id="emailsubject"
editable="true"/>
<mx:TextArea x="103" y="102" width="291" height="236" id="emailmessage"
editable="true"/>
<mx:Label x="63" y="15" text="To:" textAlign="right"/>
<mx:Label x="37" y="103" text="Message:" textAlign="right"/>
<mx:Label x="52" y="45" text="From:"/>
<mx:Label x="37" y="75" text="Subject:"/>
<mx:Button x="402" y="13" label="Send" id="emailsend"
click="sendMessage();"/>
<mx:Label id="messagestatus" x="103" y="350" width="291" text="message
not sent yet"/>
2.
Save the file.
Kommentare zu diesen Handbüchern