加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex一个RemoteObject调用JAVA对象里面的多个方法(转)

发布时间:2020-12-15 01:13:57 所属栏目:百科 来源:网络整理
导读:来源:http://yaodaqing.iteye.com/blog/1103425 Java代码?? 1 、FLEX集合PureMVC进行项目开发(FLEX+BlazeDS+PureMVC)?? 2 、FLEX的持久层调用java层代码的时候,如果要调用一个对象里面的多个方法,做法如下?? package ?com.wynlink.model?? {?? ???? impor

来源:http://yaodaqing.iteye.com/blog/1103425

Java代码??

收藏代码

  1. 1、FLEX集合PureMVC进行项目开发(FLEX+BlazeDS+PureMVC)??
  2. 2、FLEX的持久层调用java层代码的时候,如果要调用一个对象里面的多个方法,做法如下??

package?com.wynlink.model??
  • {??
  • ????import?mx.collections.ArrayCollection;??
  • import?mx.controls.Alert;??
  • import?mx.rpc.events.ResultEvent;??
  • import?mx.rpc.remoting.Operation;??
  • import?mx.rpc.remoting.RemoteObject;??
  • ??????
  • import?org.puremvc.as3.patterns.proxy.Proxy;??
  • public?class?MobilePhoneProxy?extends?Proxy??
  • ????{??
  • ????????static?const?NAME:String?=?"MobilePhoneProxy";??
  • const?GET_PHONE_USER_CALLBACK:String?=?"getPhoneUserCallBack";??
  • const?GET_PHONE_TEMPLATE_CALLBACK:String?=?"getPhoneTemplateCallBack";??
  • ??????????
  • private?var?mobile:RemoteObject;??
  • public?var?op1:Operation;??
  • public?var?op2:Operation;??
  • public?function?MobilePhoneProxy(data:Object=null)??
  • ????????{??
  • ????????????super(NAME,?data);??
  • ??????????????
  • ????????????mobile?=?new?RemoteObject();??
  • ????????????mobile.destination?=?"phone";??
  • ????????????mobile.endpoint?=?"/Project_ydq/messagebroker/amf";??
  • ????????????mobile.showBusyCursor?=?true;??
  • ????????????//操作定义??
  • ????????????op1?=?new?Operation();??
  • ????????????op1.addEventListener(ResultEvent.RESULT,?getPhoneUserCallBack);//如果是此事件,则回调此方法??
  • ????????????op2?=? ????????????op2.addEventListener(ResultEvent.RESULT,?getPhoneTemplateCallBack);??
  • //多个操作加入远程对象??
  • ????????????mobile.operations?=?{"getPhoneUser"?:?op1,"getPhoneTemplate"?:?op2};//JAVA对象里的方法??
  • //mobile.addEventListener(ResultEvent.RESULT,?showSMSshowSMS);??
  • ????????}??
  • private?function?getPhoneUserCallBack(event:ResultEvent):void?{??
  • ????????????var?re:ArrayCollection?=?event.message.body?as?ArrayCollection;??
  • if(re.length?==?0){??
  • ????????????????this.sendNotification(GET_PHONE_USER_CALLBACK,re);??
  • ????????????}??
  • null);??
  • ??????????????????????????
  • ????????}???
  • private?function?getPhoneTemplateCallBack(event:ResultEvent): ????????/*?获取接收短信的所有用户?*/??
  • public?function?getUserInfo()://mobile.getPhoneUser();??
  • ????????????op1.send();??
  • /*??获取短信模板??*/??
  • public?function?getPhoneTemplate(): ????????????op2.send();??
  • public?function?ShowMobilePhonePanel():void{??
  • ????}??
  • } ?
  • (编辑:李大同)

    【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

      推荐文章
        热点阅读