New API HTTPMultiService and HTTPOperation in Flex 3.4
来源:互联网 发布:ubuntu删除目录命令 编辑:程序博客网 时间:2024/05/22 18:10
New API HTTPMultiService and HTTPOperation in Flex 3.4
<!-- HTTPMultiServiceSample,摘自(http://shigeru-nakagaki.com/index.cfm/2009/8/27/20090827-HTTPMultiService-and-HTTPOperation-in-Flex340)-->
<?xml version="1.0" encoding="utf-8"?><mx:Application layout="vertical" xmlns:mx="http://www.adobe.com/2006/mxml" minWidth="1024" minHeight="768" viewSourceURL="srcview/index.html" creationComplete="onCreationComplete()"> <mx:Script> <![CDATA[ //import com.adobe.serialization.json.JSONDecoder; import mx.rpc.AsyncToken; import mx.utils.ObjectUtil; import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; private function onCreationComplete():void { var s:String = application.url; trace(s); var index:int = s.indexOf(".swf"); s = s.substr(0,index); trace(s); index = s.lastIndexOf("/"); s = s.substr(0,index); trace(s); srv.baseURL = s + "/"; // if you set a service at constructor, you can't set srv.operationList = [op]; // also you can't get operation if you set a service at constructor //var op:mx.rpc.http.Operation = new mx.rpc.http.Operation(srv, "getData"); var op:mx.rpc.http.Operation = new mx.rpc.http.Operation(null, "getData"); op.url = s + "/test.cfm"; op.method = URLRequestMethod.POST; op.addEventListener(ResultEvent.RESULT, onResult); op.addEventListener(FaultEvent.FAULT, onFault); srv.operationList = [op]; } private function test():void { var args:Object = new Object(); args.hoge = "abc"; args.foo = 123; var op:mx.rpc.http.Operation = mx.rpc.http.Operation(srv.getOperation("getData")); trace("result event : " + op.hasEventListener(ResultEvent.RESULT)); trace("fault event : " + op.hasEventListener(FaultEvent.FAULT)); var at:AsyncToken = op.send(args); at.bar = "XYZ"; } private function onResult(e:ResultEvent):void { /* var json:JSONDecoder = new JSONDecoder(e.result.toString()); var obj:Object = json.getValue(); Alert.show(ObjectUtil.toString(obj),"Success"); */ Alert.show(e.result.toString(),"Success"); } private function onFault(e:FaultEvent):void { Alert.show(ObjectUtil.toString(e.fault),"Error"); } ]]> </mx:Script> <mx:HTTPMultiService id="srv" /> <mx:Button label="test" click="test()"/> </mx:Application>
- New API HTTPMultiService and HTTPOperation in Flex 3.4
- new, newlc and new in C++
- New Notification API in Pocket PC 2002
- Flex ActionScript and MXML API Reference
- New Features in HSQLDB 1.9 and 2.0
- malloc/free and new/delete in C++
- malloc/free and new/delete in C++
- malloc/free and new/delete in C++
- 正则表达式 in java and flex
- New in the Flash Player 11 (Incubator) API
- What's New in the Revit 2018 API
- JavaSE8-The New Date and Time API(1)
- JavaSE8-The New Date and Time API(2)
- Odoo ORM API (二)- Creating Models、Compatibility between new API and old API
- What's new in Spring 2.0 and 2.5?
- Puffy and the Cryptonauts: What's New in OpenBSD 4.3
- Some new and enhanced components coming in Tiburon
- New features in Visual C++ 10 and MFC 10
- 肾气足,百病除
- PDF(复制、黏贴)时出现乱码之处理方法之一
- 新闻资讯] 非常规Flex样式定义与使用
- SQL数据类型详细描述
- C++ Templates学习笔记之:函数模板
- New API HTTPMultiService and HTTPOperation in Flex 3.4
- 索爱的SDK:semc_java_me_cldc_sdk.2-5-0-3.exe,谁知道下载地址吗??
- 在ActionScript 3.0中使用CSS
- 模板函数中指针作为调用参数时模板参数的推导问题
- ORACLE 中ROWNUM用法总结
- Kernel中断处理模型
- DB2 数据库备份、恢复和前滚
- Oracle技巧
- 自己动手写一个简单的Shell之四:流程控制