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

发布于 2024-10-29 06:20:50 字数 176 浏览 4 评论 0原文

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

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

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

谢谢!

What is the best way to go about disabling the cache in google chrome for mac, so that when I am developing a flash application, it will bring in the new movie every time?

Please advise, I can't figure out how to ensure the version of the .swf I am looking at is the most recent version.

One solution might be to get the flex compiler to append a timestamp to the .swf filenames, is this possible?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

幸福不弃 2024-11-05 06:20:50

转到“查看”菜单,打开开发人员工具。开发人员工具的右下角有一个齿轮图标。单击它,然后选中“禁用缓存”复选框。

Go to the 'View' menu, open Developer Tools. In the bottom right corner of the Developer Tools is a gear icon. Click it, then check the 'Disable Cache' checkbox.

请远离我 2024-11-05 06:20:50

在嵌入代码中,无论您在 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 文件中的代码,它将为您生成值。 :)

In your embed code where ever you the swf file you have to put a random number or a time stamp of some sort on the query. Whenever there is a query string that changes the browser will not cache the page.

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

Best method would be to embed your SWF using SWFObject with this code.

In the html body tag do this.

<body onLoad="loaded()" onunload"doUnload( )">
  <div id="replaceMe">Loading content.</div>
</body>

and for the javascript do this ( obviously changing the stuff wrapped in { } to your needs

<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>

Don't forget to add a copy of SWFobject
You will never have caching issues again

EDIT:
BTW if you replace your code in your html.template.html file with this code it will generate the values for you. :)

宣告ˉ结束 2024-11-05 06:20:50

就我个人而言,我永远不会那样做。缓存的存在是有原因的,当您在本地运行缓存时不应将其禁用。根据我的经验,最好的方法是每次构建时都有一个“版本”(通常是类中的静态)数字增量(通过使用 Ant 或 Maven;如果您也有一个自动化引擎来执行此操作,那就更好了)然后将该版本号附加为 Flash 影片的 url 参数,例如 html 中的 Movie.swf?version=1.31

Personally, I would never do that. Caching is there for a reason and shouldn't be disabled when you're running it locally. In my experience, the best way to do it is have a 'version' (normally a static properly in a Class) number increment every time you build (by using Ant or Maven; even better if you have an automation engine to do it too) which then attached that version number as a url parameter for the flash movie like Movie.swf?version=1.31 in the html.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文