Flex入门学习体会(一)
刚开始学习Flex遇到许多问题。由于本人熟悉java,下面是一些体会也会与java有关: 1、flex是单线程的; 2、与后台的交互是异步的,同时因为是单线程的原因,所以使用与后台的交互时必须使用回调函数。 提交的时候用在方法尾部加lastResult,回调函数在方法尾部加result。 例子
var publicinfo:SeamRemoteObject=new SeamRemoteObject();
var _publicServer:PublicServer;
public function PublicInfoCreat()
{
publicinfo.destination="publicPageInfo";
publicinfo.getFlexPublicInfo.addEventListener(ResultEvent.RESULT,publicCallBack); //注册回调函数
publicinfo.getFlexPublicInfo().[color=red]lastResult[/color]; //发送请求
}
private function publicCallBack(evt:ResultEvent):void{
//回调函数
_publicServer=evt.[color=red]result[/color] as PublicServer;
//trace(_publicServer.requestContextPath);
}
随着学习再添加其他的体会。