来源:http://yaodaqing.iteye.com/blog/1103425
- 1、FLEX集合PureMVC进行项目开发(FLEX+BlazeDS+PureMVC)??
- 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};??
//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{??
????}??
} ?