Flex HTTPService json
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
import mx.controls.Alert;
import com.adobe.serialization.json.JSON;
private var httpService:HTTPService = new HTTPService();
protected function button1_clickHandler(event:MouseEvent):void
{
httpService.url="http://localhost:8080/trf/xt/traffic";
httpService.method="POST"; //重要,默认GET
httpService.contentType="application/json"; //重要,默认XML
httpService.showBusyCursor = true;
httpService.addEventListener(ResultEvent.RESULT,getResult);
httpService.addEventListener(FaultEvent.FAULT,getFailure);
var sub:Object= new Object();
sub.id=1;
var para:Object =new Object();
para.cmd="findXhjById";
para.token="token";
para.params= sub;
var jstr:Object=com.adobe.serialization.json.JSON.encode(para); //重要
httpService.send(jstr);
}
private function getResult(event:ResultEvent){
Alert.show("-----------success----------");
var obj:Object= com.adobe.serialization.json.JSON.decode(event.message.body.toString());
Alert.show("address:" + obj.detail.address);
}
private function getFailure(event:FaultEvent){
Alert.show("-----------Failure----------");
}
Flex HTTPService json的更多相关文章
- Flex+Struts2+JSON实现Flex和后台的HTTP Service请求
http://www.fengfly.com/plus/view-191093-1.html Flex+Struts2+JSON的后台代码我在这就不多说了.不懂得请看我写的上一篇文章<Strut ...
- Flex httpservice返回值类型和处理 (转)
这两天在考虑flex与后端java服务交互的问题.在采用BlazeDS的Remote Object方式,还是传统的http service方式之间徘徊了一段时间 采用BlazeDS的Remote Ob ...
- Flex编码随笔
1.CSS定义最好放在application里面. 2.数据源是数组数据时,最好把数组转换为ArrayCollection. 3.List.CheckBox等控件的HttpService Params ...
- Flex远程访问获取数据--HTTPService
编写service类: package services { import com.adobe.serialization.json.JSON; import log.LogUtil; import ...
- Flex之HTTPService组件调用
1.采用<s:HTTPService>标签来实现: <?xml version="1.0" encoding="utf-8"?>< ...
- 【Flex】读取本地XML,然后XML数据转成JSON数据
干了一年H5,最近被要求写编辑器,Electron等级还不够,写不了,只有重新拿起as3,用flex,最近写到数据表编辑模块,有这部分功能,基本完成 . package utils { /** * 模 ...
- Flex与Java通信之HttpService
flashbuilder4.6.myeclipse10 参考:http://www.cnblogs.com/lovemoon714/archive/2012/05/25/2517684.html 1. ...
- flex 遍历Object或者JSON对象内容的实现代码
private function init():void { //新建对象 var obj:Object = new Object(); //增加key-value obj["name&qu ...
- 基于Flex的HTTPService(GET和POST)
一.基于GET的HTTPService: <?xml version="1.0" encoding="utf-8"?><mx:Applicat ...
随机推荐
- js兼容方法:获取当前样式|计算后样式 getStyle
function getStyle(obj,attr){ if(obj.currentStyle){ //for IE return obj.currentStyle[attr]; }else{ re ...
- IComparer 指定排序。
public class NeEntityComparer : IComparer<NeEntity> { public int Compare(NeEntity x, NeEntity ...
- JS(event事件)
常用的event事件: 属性 此事件发生在何时... onabort 图像的加载被中断. onblur 元素失去焦点. onchange 域的内容被改变. onclick 当用户点击某个对象时调用的事 ...
- three.js 场景入门
<!DOCTYPE html> <html> <head> <title>Example 01.02 - First Scene</title&g ...
- JavaScript求和
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- WPF DataGrid – Dynamically updating DataGridComboBoxColumn
The Scenario I want to do a master detail like scenario where the selection in one ComboBox cell wil ...
- jQuery的封装和扩展方式
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- HDU 2838 (DP+树状数组维护带权排序)
Reference: http://blog.csdn.net/me4546/article/details/6333225 题目链接: http://acm.hdu.edu.cn/showprobl ...
- KMP算法 hdu4686 Oulipo
Problem Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, w ...
- 5分钟 wamp下php phpmaile发送qq邮件 2015最新方法说明
13:40 2015/11/20 5分钟 wamp下php phpmaile发送qq邮件 2015最新方法说明 关键点:现在qq邮箱开通smtp服务后会给你一个很长的独立新密码,发邮件配置中的密码需要 ...