---
title: "flex 3, flex4 连续调用 一个 httpservice时，只有第一次到达了server端"
author: "speed847"
date: "2014-04-08T01:16:30Z"
tags: []
categories: ["移动开发"]
slug: "flex-3-flex4-httpservice-server"
draft: false
lastmod: "2014-04-08T01:16:30Z"
id: 2041902
url: "https://speed847.iteye.com/blog/2041902"
---

[http://blog.sina.com.cn/s/blog\_538d55be0101dk0d.html](http://blog.sina.com.cn/s/blog_538d55be0101dk0d.html)

 

原因是 如果连续调用server的一个URL，只有第一次真正到达了server，剩下的调用直接走缓存。[](http://blog.sina.com.cn/s/blog_538d55be0101dk0d.html)

 

解决方法是，让每次调用的URL都不一样：

 

mxml的写法：

 

AS的写法：

this.ser = new HTTPService();

this.ser.url = "http://localhost:8080/p3/getstatus?t="+String(Math.round(Math.random()\*1000));

this.ser.useProxy = false;

this.ser.addEventListener(ResultEvent.RESULT,service\_resultHandler);

this.ser.addEventListener(FaultEvent.FAULT,service\_faultHandler);

this.ser.send();