- 1
- 0
- 约3.57千字
- 约 4页
- 2018-05-06 发布于河南
- 举报
Cairngorm小结
Business(业务逻辑部分)。
Delegate
Delegate相当于一个代理,通过Command调用,它的工作是定位远程服务并且完成相应的服务调用,ServiceLocator就是这个远程服务的定义。Delegate是一个单例模式。
public function CountDelegate(responder:IResponder)
{
this.responder = responder;
}
public function count(num:Num):void //command的execute函数中调用
{
?private var remoteObject:RemoteObject = ServiceLocator.getInstance().get RemoteObject(counting);?
remoteObject.addEventListener(ResultEvent.RESULT,OnResult);
remoteObject.getOperation(count).send(counter); //调用远程服务器端函数count
??????????flash.utils.setTimeout(counting, 1000);//设置超时为1000ms
}??
Private function OnResult(evt:Res
原创力文档

文档评论(0)