Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-16-2009, 06:44 AM   #1
archloxx
Member
 
Join Date: Sep 2007
Posts: 81
Default no cache?

hi all and thanx in advance


i wanted to know if there is a possible way to make the browser forget the flash file each time i quit!!!

the problem is that computers store information about flash file making it hard if you update your work!!! people always get the old version even when you update it, because they visited it once!!!

can i make them always see the updates without the need to delete cache or temporary files?????

regards
archloxx

Last edited by archloxx; 02-16-2009 at 06:46 AM.
archloxx is offline   Reply With Quote
Old 02-16-2009, 03:57 PM   #2
tadster
tadster
 
tadster's Avatar
 
Join Date: Feb 2009
Location: Texas
Posts: 2,111
Default

yes. You will need to create a cloke swf that will load the real swf.
In the cloke call the real swf with php or some other server code that will add no cache headers to the request before responding with the file. Also, you will need to add request headers in the flash that calls the php.
example:
in the AS3:
private var nocache:URLRequestHeader =
new URLRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
...
var swfloader:Loader = new Loader();
var request:URLRequest = new URLRequest("phploader.php");
var headers:Array = new Array(nocache);
request.requestHeaders = headers;
request.method = URLRequestMethod.POST;
swfloader.load(request);

in the php:
header("Cache-Control: no-store,no-cache,must-revalidate);
echo(myswffile.swf);

this is a basic example that does not show everything, i hope you can get the general idea.

you can see this in action on my website, none of the examples get cached.
the banner does get cached
tadster is offline   Reply With Quote
Old 02-17-2009, 10:24 PM   #3
ggalan
Senior Member
 
ggalan's Avatar
 
Join Date: Feb 2006
Location: New York
Posts: 620
Default

does phploader.php get cahched?
ggalan is offline   Reply With Quote
Old 02-20-2009, 07:49 PM   #4
tadster
tadster
 
tadster's Avatar
 
Join Date: Feb 2009
Location: Texas
Posts: 2,111
Default

no, not in the sense that it needs too. All the actual php code gets done on the server, the only thing that would be cache-able is any response that phploader would give to the browser. But using headers before that response can limit the cache of even such a response.
tadster is offline   Reply With Quote
Old 02-21-2009, 04:42 AM   #5
ggalan
Senior Member
 
ggalan's Avatar
 
Join Date: Feb 2006
Location: New York
Posts: 620
Default

could you explain your technique further please
thank you
ggalan is offline   Reply With Quote
Old 02-23-2009, 08:10 PM   #6
tadster
tadster
 
tadster's Avatar
 
Join Date: Feb 2009
Location: Texas
Posts: 2,111
Default cache days

Quote:
Originally Posted by ggalan View Post
could you explain your technique further please
thank you
alright, here we go:

inside a loader swf that does get cached:
the AS3:
Code:
new URLRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
...
var swfloader:Loader = new Loader();
//this phploader file is what outs your flash file
//it outputs binary data
//just echo(file_get_contents("your.swf"));
//theres alot more to it than that for more security
//but this answers in general your original question
var request:URLRequest = new URLRequest("phploader.php");
var headers:Array = new Array(nocache);
request.requestHeaders = headers;
request.method = URLRequestMethod.POST;
swfloader.load(request);
addChild(swfloader);

goto my site actiontad.com and try to load tadspingpong.swf
you'll get a blank swf,
however that is the call to the ping pong game in examples

it is the loader swf that loads the real swf file
in a similar (more complex) manner as what I am describing here



inside 'phploader.php'
the php:
PHP Code:
<?php
$thisfile
=file_get_contents("myswf.swf");
header("Cache-Control""no-cache, no-store, must-revalidate");
header("Pragma""no-cache");
echo(
$thisfile);
clearstatcache();
exit;
?>

now this can get very involved, but generally speaking, a swf loaded this way will not get cached.

lets get deeper a bit:
ie has whats known as a secret cache,
(so Iv'e been told)
Responses from the server can be kept there even if no cache headers where sent. (i've never seen this happen to a swf outed in the above way)

A person with a packet sniffer can still get your swf files rather easily if you just use a simple method as defined above.
The key to besting a sniffer is breaking up packets, but that is more than i will get into here and now.

I hope you can get a good idea of what i'm talking about, if not, just know that in general no matter what you do, things (code) on the web can and will be seen.
tadster is offline   Reply With Quote
Old 02-23-2009, 08:22 PM   #7
tadster
tadster
 
tadster's Avatar
 
Join Date: Feb 2009
Location: Texas
Posts: 2,111
Default

Quote:
Originally Posted by archloxx View Post
hi all and thanx in advance


i wanted to know if there is a possible way to make the browser forget the flash file each time i quit!!!

......
can i make them always see the updates without the need to delete cache or temporary files?????

regards
archloxx
so..yes.. to sum up and be more clear:
You'll need to make a loader AS3 swf file.
(by the way my examples pertain to packaged AS3 used with only the mxmlc.exe compiler)
The loader swf file will always get cached.
Inside the loader you can put a call to a php page that will output
the real swf file after no cache headers.
Inside the loader is a Loader Object set up to hold the response as a swf file.
This loader Object then gets added as the only thing on the display.
And thats how to load a swf via AS3 and php so that it does not get cached.

the examples section on actiontad.com is a working example of this methodology.
tadster is offline   Reply With Quote
Old 02-25-2009, 01:29 PM   #8
ggalan
Senior Member
 
ggalan's Avatar
 
Join Date: Feb 2006
Location: New York
Posts: 620
Default

thank you!
ggalan is offline   Reply With Quote
Old 03-01-2009, 04:28 AM   #9
archloxx
Member
 
Join Date: Sep 2007
Posts: 81
Default

thank you
archloxx is offline   Reply With Quote
Old 03-03-2009, 05:53 AM   #10
deepak819
Registered User
 
Join Date: Mar 2009
Posts: 10
Default

that is very good information thanks for sharing it.......
deepak819 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird cache related AS problem kilauea ActionScript 2.0 2 08-09-2008 04:01 AM
How to pass parameter to AS2 movie and still use browser's cache? coolburn ActionScript 3.0 3 11-21-2007 10:38 AM
How do I get a SWF file to update if it is newer than the cache one? Glen Charles Rowell ActionScript 3.0 4 10-01-2007 02:59 AM
fileReference download cache shunt Flash 8 General Questions 2 06-22-2007 10:26 AM
error with cache [Flash-XML-PHP-MySQL] ekarapanos ActionScript 2.0 1 05-17-2004 08:08 AM


All times are GMT. The time now is 12:12 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.