
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
19
newClient.writeAccess = "/" + userName;
this.acceptConnection(newClient);
} else {
var err = new Object();
err.message = "Invalid password";
this.rejectConnection(newClient, err);
}
};
If the password is incorrect, the user is rejected and an information object with a message property set to “Invalid
password”
is returned to the client side. The object is assigned to infoObject.application. To access the
message property, use the following code on the client side:
ClientCom.onStatus = function (info.application.message){
trace(info.application.message);
// Prints "Invalid password"
// in the Output panel on the client side.
};
application.onConnectAccept()
application.onConnectAccept = function (clientObj [,p1, ..., pN]){}
Invoked when a client successfully connects to an application; for use with version 2 components only. Use
onConnectAccept() to handle the result of an accepted connection in an application that contains components.
If you don’t use the version 2 components framework (ActionScript 2.0 components), you can execute code in the
application.onConnect() handler after accepting or rejecting the connection. When you use the components
framework, however, any code that you want to execute after the connection is accepted or rejected must be placed
in the
application.onConnectAccept() and application.onConnectReject() event handlers. This archi-
tecture allows all of the components to decide whether a connection is accepted or rejected.
Availability
Flash Media Server (with version 2 media components only).
Parameters
clientObj A Client object; the client connecting to the application.
p1, ..., pN Optional parameters passed to the application.onConnectAccept() method. These parameters
are passed from the client-side
NetConnection.connect() method when a client connects to the application; they
can be any ActionScript data type.
Example
The following example is client-side code:
nc = new NetConnection();
nc.connect("rtmp:/test","jlopes");
nc.onStatus = function(info) {
trace(info.code);
};
nc.doSomething = function(){
trace("doSomething called!");
}
The following example is server-side code:
Komentarze do niniejszej Instrukcji