MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Instrukcja Użytkownika Strona 34

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 80
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 33
34
The following server-side script uses the Client.call method inside the
application.onConnect handler to call the random method that was defined on the client side.
The server-side script also defines a function called randHander, which is used in the
Client.call method as the resultObj parameter.
application.onConnect = function(clientObj){
trace("we are connected");
application.acceptConnection(clientObj);
clientObj.call("random", new randHandler());
};
randHandler = function(){
this.onResult = function(res){
trace("random num: " + res);
}
this.onStatus = function(info){
trace("failed and got:" + info.code);
}
};
Client."commandName"
Availability
Flash Communication Server MX.
Usage
function onMyClientCommand([p1, ..., pN])
{
// insert code here
return val;
}
Parameters
p1, ..., pN Optional parameters passed to the command message handler if the message
contains parameters you defined. These parameters are the ActionScript objects passed to the
NetConnection.call method.
Returns
Any ActionScript object you define. This object is serialized and sent to the client as a response to
the command only if the command message supplied a response handler.
Description
Event handler; invoked when a Flash client or another server calls the NetConnection.call
method. A command name parameter is passed to
NetConnection.call on the client side,
which causes Flash Communication Server to search the Client object instance on the server side
for a function that matches the command name parameter. If the parameter is found, the method
is invoked and the return value is sent back to the client.
Example
This example creates a method called sum as a property of the Client object newClient on the
server side:
newClient.sum = function sum(op1, op2){
return op1 + op2;
};
Przeglądanie stron 33
1 2 ... 29 30 31 32 33 34 35 36 37 38 39 ... 79 80

Komentarze do niniejszej Instrukcji

Brak uwag