MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Bedienungsanleitung Seite 33

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 80
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 32
Server-Side Communication ActionScript 33
Example
The following example checks the agent property against the string "WIN" and executes different
code depending on whether they match. This code is written inside an
onConnect function.
function onConnect(newClient, name){
if (newClient.agent.indexOf("WIN") > -1){
trace ("Window user");
} else {
trace ("non Window user.agent is" + newClient.agent);
}
}
Client.call
Availability
Flash Communication Server MX.
Usage
Client.call(methodName, [resultObj, [p1, ..., pN]])
Parameters
methodName 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 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 you define and, in order to be useful, 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 ActionScript object. These parameters are passed to the
methodName parameter when
the method executes on the Flash client. If you use these optional parameters, you must pass in
some value for
resultObject; 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.
Description
Method; executes a method on the originating Flash client or on another server. The remote
method may optionally return data, which is returned as a result to the
resultObj parameter, if it
is provided. The remote object is typically a Flash client connected to the server, but it can also be
another server. Whether the remote agent is a Flash client or another server, the method is called
on the remote agents NetConnection object.
Example
The following example shows a client-side script that defines a function called random, which
generates a random number:
nc = new NetConnection();
nc.connect ("rtmp://someserver/someApp/someInst");
nc.random = function(){
return (Math.random());
};
Seitenansicht 32
1 2 ... 28 29 30 31 32 33 34 35 36 37 38 ... 79 80

Kommentare zu diesen Handbüchern

Keine Kommentare