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

  • 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 165
Chapter 588
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 invoke the tests.
Client.prototype.runTests = function() {
trace("***** runTests");
5
In the same function, create an instance of the Flash Remoting service, testService. The
second parameter,
new TestResult(this), is a handler you’ll define farther down in this file
to catch the data coming back from the Flash Remoting service.
// Get a reference to the service. “simple.simple” refers
// to the ColdFusion file, simple.cfc, found in the "simple"
// directory under the deployed CF directory.
var testService =
application.gatewayConnection.getService("simple.simple",
new TestResult(this));
6
Call testService methods to get the results from the Flash Remoting methods getBoolean,
getArray, and addNumbers, and close the function.
// Call the "testService" function on Flash Remoting
// to get a Boolean, an array, and a sum.
testService.getBoolean(true);
testService.getArray();
testService.addNumbers(1,3);
return "Ran the service on the server";
}
7
Provide the TestResult function as a handler for data coming from the Flash Remoting
service.
// Create a TestResult function
function TestResult(client) {
this.client = client;
}
Zobrazit stránku 165
1 2 ... 161 162 163 164 165 166 167 168 169 170 171 ... 368 369

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

Žádné komentáře