Packagemx.rpc.remoting.mxml
Classpublic dynamic class RemoteObject
InheritanceRemoteObject Inheritance RemoteObject Inheritance AbstractService Inheritance flash.utils.Proxy
Implements IMXMLSupport, IMXMLObject

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Use the <mx:RemoteObject> tag to represent an HTTPService object in an MXML file. This tag gives you access to the methods of Java objects using Action Message Format (AMF) encoding.

MXML SyntaxexpandedHide MXML Syntax

The <mx:RemoteObject> tag accepts the following tag attributes:

 <mx:RemoteObject
  Properties
  concurrency="multiple|single|last"
  destination="No default."
  id="No default."
  endpoint="No default."
  showBusyCursor="false|true"
  source="No default." (currently, Adobe ColdFusion only)
  makeObjectsBindable="false|true"
  
  Events
  fault="No default."
  result="No default."  
 />
 

<mx:RemoteObject> can have multiple <mx:method> tags, which have the following tag attributes:

 <mx:method
  Properties
  concurrency="multiple|single|last"
  name="No default, required."
  makeObjectsBindable="false|true"
         
 Events
  fault="No default."
  result="No default."
 />
 

It then can have a single <mx:arguments> child tag which is an array of objects that is passed in order.

View the examples



Public Properties
 PropertyDefined By
 InheritedchannelSet : ChannelSet
Provides access to the ChannelSet used by the service.
AbstractService
 Inheritedconcurrency : String
Value that indicates how to handle multiple calls to the same service.
RemoteObject
 InheritedconvertParametersHandler : 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.
RemoteObject
 InheritedconvertResultHandler : 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.
RemoteObject
 Inheriteddestination : String
The destination of the service.
AbstractService
 Inheritedendpoint : 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.
RemoteObject
 InheritedkeepLastResult : Boolean
Flag indicating whether the service's operations should keep their last call result for later access.
AbstractService
 InheritedmakeObjectsBindable : Boolean
When this value is true, anonymous objects returned are forced to bindable objects.
RemoteObject
 Inheritedmanagers : Array
The managers property stores a list of data managers which modify the behavior of this service.
AbstractService
 Inheritedoperations : Object
The Operations array is usually only set by the MXML compiler if you create a service using an MXML tag.
AbstractService
 InheritedrequestTimeout : int
Provides access to the request timeout in seconds for sent messages.
AbstractService
 InheritedshowBusyCursor : Boolean
If true, a busy cursor is displayed while a service is executing.
RemoteObject
 Inheritedsource : String
Lets you specify a source value on the client; not supported for destinations that use the JavaAdapter.
RemoteObject
Protected Properties
 PropertyDefined By
 Inherited_keepLastResult : Boolean = true
AbstractService
Public Methods
 MethodDefined By
  
RemoteObject(destination:String = null)
Create a new RemoteObject.
RemoteObject
 Inherited
disconnect():void
Disconnects the service's network connection and removes any pending request responders.
AbstractService
  
[override] Returns an Operation of the given name.
RemoteObject
 Inherited
initialize():void
Called to initialize the service.
AbstractService
  
initialized(document:Object, id:String):void
Called automatically by the MXML compiler if the RemoteObject is set up using a tag.
RemoteObject
 Inherited
logout():void
Logs the user out of the destination.
AbstractService
 Inherited
setCredentials(username:String, password:String, charset:String = null):void
Sets the credentials for the destination accessed by the service when using Data Services on the server side.
AbstractService
 Inherited
setRemoteCredentials(remoteUsername:String, remotePassword:String, charset:String = null):void
[override] 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.
RemoteObject
 Inherited
toString():String
Represents an instance of RemoteObject as a String, describing important properties such as the destination id and the set of channels assigned.
RemoteObject
Events
 Event Summary Defined By
 InheritedThe fault event is dispatched when a service call fails and isn't handled by the Operation itself.AbstractService
 InheritedThe invoke event is dispatched when a service Operation is invoked so long as an Error is not thrown before the Channel attempts to send the message.AbstractService
 InheritedThe result event is dispatched when a service call successfully returns and isn't handled by the Operation itself.AbstractService
Constructor Detail
RemoteObject()Constructor
public function RemoteObject(destination:String = null)

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Create a new RemoteObject.

Parameters
destination:String (default = null) — The destination of the RemoteObject, should match a destination name in the services-config.xml file.
Method Detail
getOperation()method
override public function getOperation(name:String):AbstractOperation

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Returns an Operation of the given name. If the Operation wasn't created beforehand, a new mx.rpc.remoting.mxml.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:String — Name of the Operation.

Returns
AbstractOperation — Operation that executes for this name.
initialized()method 
public function initialized(document:Object, id:String):void

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Called automatically by the MXML compiler if the RemoteObject is set up using a tag. If you create the RemoteObject through ActionScript you may want to call this method yourself as it is useful for validating any arguments.

Parameters

document:Object — the MXML document on which this RemoteObject lives
 
id:String — the id of this RemoteObject within the document

Examples
RemoteObjectExample.mxml
<?xml version="1.0" encoding="utf-8"?>
<!--

  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

-->
<!-- Simple example to demonstrate the RemoteObject tag. -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark" 
     xmlns:mx="library://ns.adobe.com/flex/mx">
        
    <!--  Make sure the Flex Data Services proxy-config.xml file contains the following definition.
    The Java class mypackage.stockquote.MyTicker.class must be available on the 
    web application's classpath.
        
    <destination id="MyRemoteObjectDest">
        <properties>
            <source>mypackage.stockquote.MyTicker</source>
            <scope>application</scope>
        </properties>
    </destination>
    -->
        
    <fx:Script>
        <![CDATA[
            import mx.controls.Alert;        
        ]]>    
    </fx:Script>

    <fx:Declarations>
        <mx:RemoteObject id="RO" destination="MyRemoteObjectDest"
            fault="Alert.show(event.fault.faultString), 'Error'">
            
            <mx:method name="GetQuote">
                <mx:arguments>
                    <symbol>{stockSymbol.text}</symbol>
                </mx:arguments>
            </mx:method>
        </mx:RemoteObject>
    </fx:Declarations>
        
    <mx:Panel title="RemoteObject Example" height="75%" width="75%" 
        paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
            
        <mx:Label width="100%"  color="blue"
            text="Enter a stock symbol to obtain a quote."/>
            
        <mx:TextInput id="stockSymbol" text="ADBE"/>
        <mx:Button label="Get Quote" click="RO.GetQuote.send()"/>
            
        <mx:Text htmlText="Company: {RO.GetQuote.lastResult.GetQuoteResult.StockQuote.Company}"/>
        <mx:Text htmlText="Current price: ${RO.GetQuote.lastResult.GetQuoteResult.StockQuote.Price}"/>
    </mx:Panel>    
</s:Application>