MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Specifikace Strana 170

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 369
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 169
Chapter 592
3 In the onConnect function, accept the clients connection.
application.onConnect = function (clientObj) {
trace("***** on connect");
// Accept the connection for this client.
this.acceptConnection(clientObj);
return true;
}
4
Provide a prototype function that the client can call to send the mail.
// Handle the client’s call to sendMail.
Client.prototype.sendMail = function(to, from, subject, body) {
trace("***** sending mail");
// Call the sendMail function of the Flash Remoting instance
// created in application.onAppStart, above.
application.mailSendService.sendMail(to, from, subject, body);
}
5
Save the file as main.asc in a doc_mailto directory under the flashcom applications directory.
Note: Save this main.asc file where you’ve chosen to store your server-side application files. For more
information see Chapter 1, “The flashcom application directory,” on page 15.
To write the ColdFusion component for this sample:
1 Using your standard editor, create a new file and add code to name the application and indicate
how to access it.
<cfcomponent name="sendMail" access="remote">
2
Create the sendMail function and define each parameter.
<cffunction name="sendMail" output="false"
description="send mail to a client" access="remote">
<cfargument name="to" required="true" type="string"
description="recipient of the email">
<cfargument name="from" required="true" type="string"
description="sender of the email">
<cfargument name="subject" required="true" type="string"
description="subject heading">
<cfargument name="body" required="true" type="string"
description="body text of the email">
3
Call the ColdFusion method cfmail to send the message.
<cfmail to = "#to#" from = "#from#"subject = "#subject#">#body#</cfmail>
<cftrace category="UDF End" inline = "True"
text = "Email was sent" var = "MyStatus">
</cffunction>
</cfcomponent>
4
Save the file as sendmail.cfc in the mail application directory under the directory where you
publish all of your ColdFusion MX files.
Zobrazit stránku 169
1 2 ... 165 166 167 168 169 170 171 172 173 174 175 ... 368 369

Komentáře k této Příručce

Žádné komentáře