利用第三方组件RemoteObjectAMF0来连接:

来源:互联网 发布:mac生成chm 编辑:程序博客网 时间:2024/04/27 18:45

1.1.1.      利用第三方组件RemoteObjectAMF0来连接:

1RemoteObjectAMF0组件是一种基于MXML的第三方组件,用于连接AMF网关,同时它是一个开源的组件。首先下载RemoteObjectAMF0后解压,在“src”文件夹中就可以看到关于该组件的源代码,它基本上是对flex中的RemoteObject组件进行的重写。可以将“src”文件夹中的“com”文件夹全部拷贝到flex的工程中,也可以将其编译成库文件再引用到Flex工程中。

2)这时将“com”文件夹拷贝到了工程中。要使用该组件,默认情况下,要在MXML文件中的“Applications”标签中加入命名空间“xmlns:renaun="com.renaun.rpc.*"”。

3RomoteObjectAMF0组件的定义语法如下所示:

<renaun:RemoteObjectAMF0 endpoint="http://localhost:4166/FluorineTest/Gateway.aspx" id="sampleRemoteObject" source="FluorineHelloWorld.HelloWorld" showBusyCursor="true">

    <renaun:methods>

       <renaun:method name="FromFluorine" result="RemoteResult(event)" fault="RemoteFault(event)"/>

    </renaun:methods>

</renaun:RemoteObjectAMF0> 

RemoteObjectAMF0组件的“endpoint”属性指明AMF网关地址,“source”属性指明类的名称空间,<名称空间:method>组件的name属性指向类中的方法,必须与类中的定义相同,result事件处理返回的数据。

4RemoteObjectAMF0的调用方法跟RemoteObject时差不多,比如都可以通过sampleRemoteObject.FromFluorine(this.txtHelloWorld.text);去调用.NET中的FromFluorine()方法(通信过程中的例子)。

原创粉丝点击