
39
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
Returns
A boolean value of true if a call to methodName was successful on the client; otherwise, false.
Example
The following ActionScript 2.0 example shows a client-side script that defines a function called getNumber() that
generates a random number:
nc = new NetConnection();
nc.getNumber = function(){
return (Math.random());
};
nc.connect("rtmp:/clientCall");
The following is the same code in ActionScript 3.0:
var nc:NetConnection = new NetConnection()
var ncClient = new Object();
nc.client = ncClient;
ncClient.getNumber = nc_getNumber;
function nc_getNumber():void{
return (Math.random());
}
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()
Note: This method is not supported over RTMFP connections.
Call this method from a client-side script to detect client bandwidth. If the client is connected directly to the origin
server, bandwidth detection occurs on the origin. If the client is connected to the origin server through an edge server,
bandwidth detection happens at the first edge to which the client connected.
To use this method to detect client bandwidth, define onBWDone() and onBWCheck() methods in a client-side script.
For more information, see the Adobe Media Server Developer Guide.
Commentaires sur ces manuels