MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Spécifications Page 169

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 369
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 168
Application Server Connectivity 91
To write the client-side ActionScript for this sample:
1 Add the following debug code to trace all the status information coming back from the Flash
Communication Server.
// Trace all the status information.
function traceStatus(info) {
trace("Level: " + info.level + " Code: " + info.code);
}
// Create onStatus prototypes for the objects that
// will return status.
NetConnection.prototype.onStatus = traceStatus;
NetStream.prototype.onStatus = traceStatus;
SharedObject.prototype.onStatus = traceStatus;
2
Create the event handler for the send_btn button. Notice the call to sendMail. This invokes
the function you’ll define later in the server-side code. The second parameter,
null, tells the
Flash Communication Server that the client doesnt expect a result to be returned.
// Send the mail. The second parameter, null, tells the
// Flash Communication Server not to return a value. The remaining
// parameters provide the data to send.
function sendMail() {
main_nc.call("sendMail", null, ToText.text, FromText.text,
SubjectText.text, BodyText.text);
}
3
Create a new network connection and connect to the application.
// Create a new connection and connect to the application
// instance on the Flash Communication Server.
main_nc = new NetConnection();
main_nc.connect("rtmp:/doc_mailto/room_01");
To write the server-side ActionScript for this sample:
1 Create a new file using your server-side ActionScript editor, and load the netservices.asc file to
enable Flash Remoting through the Flash Communication Server. Remember to add a copy of
this file in the doc_remoting directory.
load("netservices.asc");
2
In the onAppStart function, define the location of the Flash Remoting service, and connect to
it.
application.onAppStart = function() {
trace("***** on app start");
// Set the default gateway URL.
NetServices.setDefaultGatewayUrl("http://localhost:8500/flashservices/
gateway");
// Connect to the gateway.
var gatewayConnnection = NetServices.createGatewayConnection();
// Get a reference to the service. "mail.sendMail" refers
// to the ColdFusion file, sendMail.cfc, found in the mail
// application directory under the deployed ColdFusion directory.
this.mailSendService = gatewayConnnection.getService("mail.sendMail",
this);
}
Vue de la page 168
1 2 ... 164 165 166 167 168 169 170 171 172 173 174 ... 368 369

Commentaires sur ces manuels

Pas de commentaire