The RemoteObject class gives you access to classes on a remote application server.

Constructor

@:value({ destination : null })new(?destination:String)

Creates a new RemoteObject.

Parameters:

destination

[optional] Destination of the RemoteObject; should match a destination name in the services-config.xml file.

Variables

@:flash.propertyconcurrency:String

Value that indicates how to handle multiple calls to the same service. The default value is multiple. The following values are permitted:

  • multiple - Existing requests are not cancelled, and the developer is responsible for ensuring the consistency of returned data by carefully managing the event stream. This is the default.
  • single - Making only one request at a time is allowed on the method; additional requests made while a request is outstanding are immediately faulted on the client and are not sent to the server.
  • last - Making a request causes the client to ignore a result or fault for any current outstanding request. Only the result or fault for the most recent request will be dispatched on the client. This may simplify event handling in the client application, but care should be taken to only use this mode when results or faults for requests may be safely ignored.

convertParametersHandler:Function

An optional function, primarily intended for framework developers who need to install a function to get called with the parameters passed to each remote object invocation. The function takes an array of parameters and returns the potentially altered array.

The function definition should look like: function myParametersFunction(parameters:Array):Array

convertResultHandler:Function

An optional function, primarily intended for framework developers who need to install a hook to process the results of an operation before notifying the result handlers.

The function definition should look like: function myConvertResultsFunction(result:*, operation:AbstractOperation):*

It is passed the result just after the makeObjectsBindable conversion has been done but before the result event is created.

@:flash.propertyendpoint:String

This property allows the developer to quickly specify an endpoint for a RemoteObject destination without referring to a services configuration file at compile time or programmatically creating a ChannelSet. It also overrides an existing ChannelSet if one has been set for the RemoteObject service.

If the endpoint url starts with "https" a SecureAMFChannel will be used, otherwise an AMFChannel will be used. Two special tokens, {server.name} and {server.port}, can be used in the endpoint url to specify that the channel should use the server name and port that was used to load the SWF.

Note: This property is required when creating AIR applications.

@:flash.propertymakeObjectsBindable:Bool

When this value is true, anonymous objects returned are forced to bindable objects.

@:flash.propertyshowBusyCursor:Bool

If true, a busy cursor is displayed while a service is executing. The default value is false.

@:flash.propertysource:String

Lets you specify a source value on the client; not supported for destinations that use the JavaAdapter. This allows you to provide more than one source that can be accessed from a single destination on the server.

Methods

getOperation(name:String):AbstractOperation

Returns an Operation of the given name. If the Operation wasn't created beforehand, a new mx.rpc.remoting.Operation is created during this call. Operations are usually accessible by simply naming them after the service variable (myService.someOperation), but if your Operation name happens to match a defined method on the service (like setCredentials), you can use this method to get the Operation instead.

Parameters:

name

Name of the Operation.

Returns:

Operation that executes for this name.

@:value({ charset : null })setRemoteCredentials(remoteUsername:String, remotePassword:String, ?charset:String):Void

If a remote object is managed by an external service, such a ColdFusion Component (CFC), a username and password can be set for the authentication mechanism of that remote service.

Parameters:

remoteUsername

the username to pass to the remote endpoint

remotePassword

the password to pass to the remote endpoint

charset

The character set encoding to use while encoding the remote credentials. The default is null, which implies the legacy charset of ISO-Latin-1. The only other supported charset is "UTF-8".

toString():String

Represents an instance of RemoteObject as a String, describing important properties such as the destination id and the set of channels assigned.

Returns:

Returns a String representing an instance of a RemoteObject.

Inherited Variables

Defined by AbstractService

@:flash.propertychannelSet:ChannelSet

Provides access to the ChannelSet used by the service. The ChannelSet can be manually constructed and assigned, or it will be dynamically created to use the configured Channels for the destination for this service.

@:flash.propertydestination:String

The destination of the service. This value should match a destination entry in the services-config.xml file.

@:flash.propertykeepLastResult:Bool

Flag indicating whether the service's operations should keep their last call result for later access.

Setting this flag at the service level will set keepLastResult for each operation, unless explicitly set in the operation.

If set to true or not set, each operation's last call result will be accessible through its lastResult bindable property.

If set to false, each operation's last call result will be cleared after the call, and must be processed in the operation's result handler. This will allow the result object to be garbage collected, which is especially useful if the operation is only called a few times and returns a large result.

See also:

  • mx.rpc.AbstractInvoker#keepLastResult

@:flash.propertymanagers:Array<Dynamic>

The managers property stores a list of data managers which modify the behavior of this service. You can use this hook to define one or more manager components associated with this service. When this property is set, if the managers have a property called "service" that property is set to the value of this service. When this service is initialized, we also call the initialize method on any manager components.

@:flash.propertyrequestTimeout:Int

Provides access to the request timeout in seconds for sent messages. A value less than or equal to zero prevents request timeout.

Inherited Methods

Defined by AbstractService

disconnect():Void

Disconnects the service's network connection and removes any pending request responders. This method does not wait for outstanding network operations to complete.

initialize():Void

Called to initialize the service.

logout():Void

Logs the user out of the destination. Logging out of a destination applies to everything connected using the same ChannelSet as specified in the server configuration. For example, if you're connected over the my-rtmp channel and you log out using one of your RPC components, anything that was connected over the same ChannelSet is logged out.

Note: Adobe recommends that you use the mx.messaging.ChannelSet.logout() method rather than this method.

See also:

  • mx.messaging.ChannelSet#logout()

@:value({ charset : null })setCredentials(username:String, password:String, ?charset:String):Void

Sets the credentials for the destination accessed by the service when using Data Services on the server side. The credentials are applied to all services connected over the same ChannelSet. Note that services that use a proxy or a third-party adapter to a remote endpoint will need to setRemoteCredentials instead.

Parameters:

username

The username for the destination.

password

The password for the destination.

charset

The character set encoding to use while encoding the credentials. The default is null, which implies the legacy charset of ISO-Latin-1. The only other supported charset is "UTF-8".