在动作的URLLoader缓存问题 [英] cache problem in actionscript URLLoader

查看:298
本文介绍了在动作的URLLoader缓存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的闪存项目,我从ASPX文件中获取XML数据中的一个。但它始终显示相同的数据和新的数据是不来在请求中。我怀疑问题是在缓存中。 下面是我的code

  VAR的URLLoader:的URLLoader =新的URLLoader();
VAR标题:的URLRequestHeader =新URLRequestHeader(缓存控制,无缓存);
VAR的URLRequest:的URLRequest =新的URLRequest(SERVERPATH +
                                         '?GetScoreDetails.aspx CardNo ='+ CardNo);
fscommand的(日志,SERVERPATH + CardNo'GetScoreDetails.aspx CardNo =?');
urlRequest.requestHeaders.push(头);
urlloader.addEventListener(引发Event.COMPLETE,loadedCompleteHandler);
对URLLoader.load(的URLRequest);
 

解决方案

  VAR xmlpath中:字符串=replaceYourXMLPathHere.xml
VAR urlReq:的URLRequest =新的URLRequest(?时间=。xmlpath中+ +新的日期()的getTime());
 

<一个href="http://www.newtonflash.com/blog/2009/06/08/$p$pvent-xml-caching-problem/#comment-43">http://www.newtonflash.com/blog/2009/06/08/$p$pvent-xml-caching-problem/#comment-43

In one of my flash project i am getting xml data from the aspx file. But it always shows the same data and the new data is not coming in the request. I suspect the problem is in cache. Below is my code

var urlloader:URLLoader=new URLLoader();
var header:URLRequestHeader = new URLRequestHeader("Cache-Control", "no-cache");
var urlRequest:URLRequest=new URLRequest(serverPath +
                                         'GetScoreDetails.aspx?CardNo='+CardNo);
fscommand("LOG", serverPath + 'GetScoreDetails.aspx?CardNo=' + CardNo );
urlRequest.requestHeaders.push(header);
urlloader.addEventListener(Event.COMPLETE, loadedCompleteHandler);
urlloader.load(urlRequest);

解决方案

var xmlPath:String="replaceYourXMLPathHere.xml"
var urlReq:URLRequest = new URLRequest(xmlPath+"?time=" + new Date().getTime());

http://www.newtonflash.com/blog/2009/06/08/prevent-xml-caching-problem/#comment-43

这篇关于在动作的URLLoader缓存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆