apache-flex - 禁用 google chrome (Mac) 中的缓存以在 flex/flash 中进行开发

标签 apache-flex google-chrome flex3 adobe cache-control

在 google chrome for mac 中禁用缓存的最佳方法是什么,这样当我开发 Flash 应用程序时,它每次都会带来新电影?

请指教,我不知道如何确保我正在查看的 .swf 版本是最新版本。

一种解决方案可能是让 flex 编译器将时间戳附加到 .swf 文件名,这可能吗?

谢谢!

最佳答案

在您的 swf 文件所在的嵌入代码中,您必须在查询中放置一个随机数或某种时间戳。每当有更改的查询字符串时,浏览器都不会缓存页面。

"MySWFName.swf?t=" + new Date().getTime();

最好的方法是使用带有此代码的 SWFObject 嵌入您的 SWF。

在 html body 标记中执行此操作。
<body onLoad="loaded()" onunload"doUnload( )">
  <div id="replaceMe">Loading content.</div>
</body>

对于 javascript 执行此操作(显然将 { } 中包裹的内容更改为您的需要
<script type="text/javascript" src="swfobject.js">
<script type="text/javascript">
  function loaded() {
    var flashvars={}, params={}, attributes={}, tmp, version, width, height, container, flashObj;
    flashvars.userName    = "testvar";

    params.menu = "true";
    params.quality = "high";
    params.bgcolor = "${bgcolor}";
    params.allowscriptaccess = "always";
    params.allownetworking = "all";

    attributes.id = "${application}";
    attributes.name = "${application}";
    attributes.align = "middle";
    attributes.allowscriptaccess = "always";
    attributes.allownetworking = "all";

    tmp = "expressInstall.swf";
    version = "${version_major}.${version_minor}.${version_revision}";
    width = "${width}";
    height = "${height}";
    container = "replaceMe";
    flashObj = "${swf}.swf?t=" + new Date().getTime();
    swfobject.embedSWF(flashObj, container, width, height, version, tmp, flashvars, params, attributes);
  }
</script>

不要忘记添加 SWFobject 的副本
您永远不会再遇到缓存问题

编辑:
顺便说一句,如果您用此代码替换 html.template.html 文件中的代码,它将为您生成值。 :)

关于apache-flex - 禁用 google chrome (Mac) 中的缓存以在 flex/flash 中进行开发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5504667/

相关文章:

jquery - 对于后端 Web 应用程序 : Flex, GWT、JQuery,您会选择什么?

apache-flex - 在 Flex/Actionscript 中连接线(拖动时)

apache-flex - Coldfusion 9 引入了 IIS Flash Remoting 请求限制

actionscript-3 - Flash Player 命令行参数为 "Create Projector"

actionscript-3 - flex中的target和currenttarget有什么区别?

c++ - Chromium 嵌入式 64 位构建

flash - 如何判断网站上是否加载了 Flash?

javascript - Chrome 扩展程序错误 - 意外的非法 token

apache-flex - Flex 3 : Error: Repeater is not executing. .. 我知道为什么,但我不知道如何修复它

apache-flex - 如何在 Flex 中的高级网格中创建叠加层