用于 Adobe® Flash® Platform 的 ActionScript® 3.0 参考
主页  |  隐藏包列表和类列表 |   |   |  新增内容  |  索引  |  附录  |  为什么显示为英语?
过滤条件: 正在从服务器检索数据...
正在从服务器检索数据...
mx.rpc.remoting.mxml 

RemoteObject  - AS3 Flex

mx.rpc.remoting.mxml
public dynamic class RemoteObject
继承RemoteObject Inheritance RemoteObject Inheritance AbstractService Inheritance Proxy
实现 IMXMLSupport, IMXMLObject

语言版本: ActionScript 3.0
产品版本: Flex 3
运行时版本: Flash Player 9, AIR 1.1

在 MXML 文件中使用 <mx:RemoteObject> 标记来表示 HTTPService 对象。此标记使您可以访问使用 Action Message Format (AMF) 编码的 Java 对象的方法。

MXML 语法expanded隐藏 MXML 语法

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.

查看示例



公共属性
 属性由以下参数定义
 InheritedchannelSet : ChannelSet
提供对服务使用的 ChannelSet 的访问。
AbstractService
 Inheritedconcurrency : String
指示如何处理对同一服务的多个调用的值。
RemoteObject
 InheritedconvertParametersHandler : Function
一个可选函数,主要供具有以下需要的框架开发人员使用:安装用传递给每个远程对象调用的参数进行调用的函数。
RemoteObject
 InheritedconvertResultHandler : Function
一个可选函数,主要供具有以下需要的框架开发人员使用:安装一个挂钩,以便在通知结果处理程序之前处理操作的结果。
RemoteObject
 Inheriteddestination : String
服务的目标。
AbstractService
 Inheritedendpoint : String
此属性可使开发人员在编译或以编程方式创建 ChannelSet 时快速指定 RemoteObject 目标的端点,而无需引用服务配置文件。
RemoteObject
 InheritedmakeObjectsBindable : Boolean
当该置为 true 时,返回的匿名对象将强制成为可绑定的对象。
RemoteObject
 Inheritedmanagers : Array
managers 属性存储修改此服务行为的数据管理器的列表。
AbstractService
 Inheritedoperations : Object
如果使用 MXML 标签创建服务,则操作数组通常仅由 MXML 编译器设置。
AbstractService
 InheritedrequestTimeout : int
提供对已发送消息的请求超时(以秒为单位)的访问。
AbstractService
 InheritedshowBusyCursor : Boolean
如果为 true,在执行服务时会显示忙状态光标。
RemoteObject
 Inheritedsource : String
用于指定客户端上的源值;不支持使用 JavaAdapter 的目标。
RemoteObject
公共方法
 方法由以下参数定义
  
RemoteObject(destination:String = null)
创建一个新的 RemoteObject。
RemoteObject
 Inherited
断开此服务的网络连接并删除任何未处理的请求 responder。
AbstractService
  
[覆盖] 返回给定名称的操作。
RemoteObject
 Inherited
调用以初始化服务。
AbstractService
  
如果使用标签设置 RemoteObject,则由 MXML 编译器自动调用。
RemoteObject
 Inherited
将用户从目标中注销。
AbstractService
 Inherited
setCredentials(username:String, password:String, charset:String = null):void
当在服务器端使用 Data Services 时,为服务访问的目标设置凭据。
AbstractService
 Inherited
setRemoteCredentials(remoteUsername:String, remotePassword:String, charset:String = null):void
[覆盖] 如果远程对象由外部服务(如 ColdFusion 组件 (CFC))管理,则可以为该远程服务的身份验证机制设置用户名和密码。
RemoteObject
 Inherited
将 RemoteObject 的实例表示为字符串,描述如目标 id 和所分配的通道集等重要属性。
RemoteObject
事件
 事件 摘要 由以下参数定义
 Inherited当服务调用失败并且操作自身不处理时,将调度 fault 事件。AbstractService
 Inherited当调用服务操作时,只要在通道尝试发送消息前没有引发错误,将调度 invoke 事件。AbstractService
 Inherited当服务调用成功返回并且操作自身不处理时,将调度 result 事件。AbstractService
构造函数详细信息

RemoteObject

()构造函数
public function RemoteObject(destination:String = null)

语言版本: ActionScript 3.0
产品版本: Flex 3
运行时版本: Flash Player 9, AIR 1.1

创建一个新的 RemoteObject。

参数
destination:String (default = null) — RemoteObject 的目标,应与 services-config.xml 文件中的目标名称匹配。
方法详细信息

getOperation

()方法
override public function getOperation(name:String):AbstractOperation

语言版本: ActionScript 3.0
产品版本: Flex 3
运行时版本: Flash Player 9, AIR 1.1

返回给定名称的操作。如果之前没有创建该操作,则将在此调用过程中创建一个新的 mx.rpc.remoting.mxml.Operation。通常只需在服务变量之后命名操作即可访问操作 (myService.someOperation),但如果 Operation 的名称恰好与服务上所定义的方法(如 setCredentials)相匹配,则可以改用此方法来获取 Operation。

参数

name:String — 操作的名称。

返回
AbstractOperation — 为此名称执行的操作。

initialized

()方法 
public function initialized(document:Object, id:String):void

语言版本: ActionScript 3.0
产品版本: Flex 3
运行时版本: Flash Player 9, AIR 1.1

如果使用标签设置 RemoteObject,则由 MXML 编译器自动调用。如果通过 ActionScript 创建 RemoteObject,则可能希望自行调用此方法(因为它对验证任何参数都非常有用)。

参数

document:Object — 此 RemoteObject 所在的 MXML 文档
 
id:String — 此 RemoteObject 在文档中的 ID

RemoteObjectExample.mxml
<?xml version="1.0" encoding="utf-8"?>
<!-- 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>




[ X ]为什么显示为英语?
《ActionScript 3.0 参考》中的内容以英语显示

《ActionScript 3.0 参考》中的部分内容未翻译成所有语言。当某个语言元素未翻译时,将显示为英语。例如,ga.controls.HelpBox 类未翻译成任何语言。因此在简体中文版的参考中,ga.controls.HelpBox 类显示为英语。