Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable cache in google chrome (Mac) for developing in flex/flash

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!

like image 988
andrewpthorp Avatar asked Feb 25 '23 15:02

andrewpthorp


2 Answers

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.

like image 56
Seanonymous Avatar answered Apr 30 '23 07:04

Seanonymous


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. :)

like image 30
The_asMan Avatar answered Apr 30 '23 07:04

The_asMan