MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE Manuale Utente Pagina 37

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 155
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 36
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
34
Parameters
methodName A string indicating a method specified in the form "[objectPath/]method". For example, the
command
"someObj/doSomething" tells the client to invoke the NetConnection.someObj.doSomething()
method on the client.
resultObj An Object. This is an optional parameter that is required when the sender expects a return value from
the client. If parameters are passed but no return value is desired, pass the value
null. The result object can be any
object that you define. To be useful, it should have two methods that are invoked when the result arrives:
onResult() and onStatus(). The resultObj.onResult() event is triggered if the invocation of the remote
method is successful; otherwise, the
resultObj.onStatus() event is triggered.
p1, ..., pN Optional parameters that can be of any ActionScript type, including a reference to another Action-
Script object. These parameters are passed to the
methodName parameter when the method is executed on the Flash
client. If you use these optional parameters, you must pass in some value for
resultObj; if you do not want a return
value, pass
null.
Returns
A boolean value of
true if a call to methodName was successful on the client; otherwise, false.
Example
The following example shows a client-side script that defines a function called
getNumber(), which generates a
random number:
nc = new NetConnection();
nc.getNumber = function(){
return (Math.random());
};
nc.connect("rtmp:/clientCall");
The following server-side script calls Client.call() in the application.onConnect() handler to call the
getNumber() method that was defined on the client. The server-side script also defines a function called
randHander(), which is used in the Client.call() method as the resultObj parameter.
randHandler = function(){
this.onResult = function(res){
trace("Random number: " + res);
}
this.onStatus = function(info){
trace("Failed with code:" + info.code);
}
};
application.onConnect = function(clientObj){
trace("Connected");
application.acceptConnection(clientObj);
clientObj.call("getNumber", new randHandler());
};
Note: This example does not work with version 2 components. For an example of calling Client.call() when using
version 2 components, see
application.onConnectAccept().
Client.checkBandwidth()
clientObject.checkBandwidth()
Vedere la pagina 36
1 2 ... 32 33 34 35 36 37 38 39 40 41 42 ... 154 155

Commenti su questo manuale

Nessun commento