The following server-side script uses the
application.onConnect
The server-side script also defines a function called
method as the
Client.call
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
Optional parameters passed to the command message handler if the message
p1, ..., pN
contains parameters you defined. These parameters are the ActionScript objects passed to the
NetConnection.call
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
method. A command name parameter is passed to
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
server side:
newClient.sum = function sum(op1, op2){
return op1 + op2;
};
28
Client.call
handler to call the
parameter.
resultObj
method.
as a property of the Client object
sum
method inside the
method that was defined on the client side.
random
, which is used in the
randHander
NetConnection.call
NetConnection.call
on the client side,
on the
newClient
Need help?
Do you have a question about the FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY and is the answer not in the manual?