flex通过remoting调用java类的实现

来源:互联网 发布:瞻博网络的老板 编辑:程序博客网 时间:2024/05/21 08:01

 1.在src写一个java类,并随便写一个方法

    2.在remoting-config.xml中配置这个java类的映射

 

<destination id="javaclass">                

<properties>

 

<source>javaclass</source>

</properties>

</destination>

 

    3.在mxml中通过RemoteObject对象使用这个远程类

        1)配置

 

<s:RemoteObject    

id="javaclass"

 

destination="javaclass"

showBusyCursor="true"

endpoint="http://localhost:8080/test/messagebroker/amf"

result="javaclass_resultHandler(event)"

fault="javaclass_faultHandler(event)"/>    

 

        2)调用

this.javaclass.get("haha");

        3)处理结果

this.lab1.text=event.result.toString();