当使用 SWFLoader 加载 swf(或其他外部远程资源)时,是否执行了任何客户端缓存 [英] When an swf (or other external remote resource) is loaded using SWFLoader, is there any client side caching performed

查看:24
本文介绍了当使用 SWFLoader 加载 swf(或其他外部远程资源)时,是否执行了任何客户端缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想知道何时使用 flex3 中的 SWFLoader(或什至 Image 组件)加载外部远程资源(例如 SWF 或 JPG)时,是否有任何客户端(即浏览器缓存?)或加载的资源.特别是第二个请求然后访问先前访问的资源只是使用缓存的资源还是会发出新的请求.很高兴知道两者是否可行(即告诉它始终使用新加载或使用缓存副本(如果可用)

Would like to know if when an external remote resource (say SWF, or JPG) is loaded using the SWFLoader (or even Image component) in flex3, if there is any client side (ie. browser caching?) or the loaded resources. In particular would a second request then to access a previously accessed resource just use the cached resource or would a new request be made. It would be nice to know if both are possible (ie. telling it to always use a fresh load or to use a cached copy if it is available)

推荐答案

浏览器负责缓存所有外部加载的媒体,例如图像声音、视频甚至 SWF.这些可以通过清除浏览器缓存来删除.我推荐 Clear Cache Button Firefox Add-on 供任何在那里测试的人使用Firefox 中的 Flash 项目.

The browser is responsible for caching all externally loaded media, such as images sounds, videos and even SWFs. These can be deleted by clearing your browser cache. I recommend the Clear Cache Button Firefox Add-on for anyone testing there Flash projects in Firefox.

但是,Flash Player 处理任何外部加载的签名 Flash 组件的缓存,例如任何 Adob​​e Flex 框架组件.您可以在此处为Flash Players 缓存了解更多信息.清除浏览器缓存不会清除这些组件.

However, Flash Player handles caching of any externally loaded signed Flash components e.g. any Adobe Flex framework components. You can read more about Flash Players cache here. Clearing your browser cache, will not clear these components.

要停止浏览器缓存文件,您需要确保每次加载时其文件名都是唯一的.您可以通过附加一个随机字符串作为 URL 变量来做到这一点.我通常使用当前时间,或者一个随机数:

To stop a file being cached by your browser, you will need to make sure its filename is unique each time it is loaded. You can do this by appending a random string as a URL variable. I usually use the current time, or a random number:

var noCache:int = new Date().getTime();
myImage.load("filename.jpg?uniq=" + noCache);

或者您可以使用URLVariables 类.

这篇关于当使用 SWFLoader 加载 swf(或其他外部远程资源)时,是否执行了任何客户端缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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