Invoking server methods from the client

Each Flash application that connects to a server application is represented by a Client object, which is an instance of the server-side Client class. Each Client object, in turn, can have developer-defined methods associated with it that are accessible remotely. (You can also use the prototype property to create remote methods available to all clients. For an example of this, see the Client class entry in the Server-Side ActionScript Language Reference.

A Flash application can then use the NetConnection.call() method to call the remotely defined method, and optionally specify a callback object to handle the result that the server returns. On the server, the method corresponding to the client call is invoked, and a result is returned to the client.

The following diagram illustrates an example of invoking a server-defined method from a client. In the diagram, the client invokes the doThis remote method over the NetConnection object named nc. The doThis method is associated with a Client object, called clientObj in this case, that represents the client.



Remote method call flow from client to server, with result passed back to client


The following table lists Flash Media Server Client Status Messages:

Code

Level

Meaning

NetStream.Clear.Success

Status

A recorded stream was deleted successfully.

NetStream.Clear.Failed

Error

A recorded stream failed to delete.

NetStream.Publish.Start

Status

An attempt to publish was successful.

NetStream.Publish.BadName

Error

An attempt was made to publish a stream that is already being published by someone else.

NetStream.Failed

Error

An attempt to use a Stream method failed.

NetStream.Unpublish.Success

Status

An attempt to unpublish was successful.

NetStream.Record.Start

Status

Recording was started.

NetStream.Record.NoAccess

Error

An attempt was made to record a read-only

stream.

NetStream.Record.Stop

Status

Recording was stopped.

NetStream.Record.Failed

Error

An attempt to record a stream failed.

NetStream.Play.Start

Status

Play was started.

NetStream.Play.StreamNotFound

Error

An attempt was made to play a stream that does not exist.

NetStream.Play.Stop

Status

Play was stopped.

NetStream.Play.Failed

Error

An attempt to play back a stream failed.

NetStream.Play.Reset

Status

A playlist was reset.

NetStream.Play.PublishNotify

Status

The initial publish to a stream was successful. This message is sent to all subscribers.

NetStream.Play.UnpublishNotify

Status

An attempt to unpublish from a stream was successful. This message is sent to all subscribers.

NetStream.Play.InsufficientBW

Status

Data is playing slower than the normal speed.

The NetStream.Failed and NetStream.Play.Failed information object also have a description property, which is a string that provides a specific reason for the failure.

The NetStream.Play.Start and NetStream.Play.Failed information object also have a details property, which is a string that provides the name of the streams being played. This is useful for multiple plays. The details property shows the name of the stream when switching from one element in the playlist to the next element.

For more information on invoking server methods remotely, see the Client."commandName" entry in the Server-Side ActionScript Language Reference.


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/fms/2/docs/00000041.html