|
-
Senior Member
[AS3] how do i prevent caching of images?
I have to load png images into flash, such that, whenever they change on server, the change should be reflected on client! But the swf loads the same image over and over during the same session! I am guessing this is because the browser returns the cached image instead of the original! So any idea how to fix this?
-
Total Universe Mod
not sure if it still works in as3 but you can tack on a random value to the end of the url path to force a unique file name. A new date object works well.
loader.load(new URLRequest("myfile.jpg?cachekill="+new Date()));
-
Senior Member
For me that works great for php, as it worked in as2, actually i like to use Date().getTime(), but when i use it for images, sometimes the image fails to load!
-
Bearded (M|G)od
The image will fail to load when testing locally, but when it's running on a server it will work just fine.
-
AKA [ Paul Bainbridge]
 Originally Posted by bluemagica
For me that works great for php, as it worked in as2, actually i like to use Date().getTime(), but when i use it for images, sometimes the image fails to load!
I also use . "?rand="+new Date().getTime()
-
Senior Member
Since my entire movie relies heavily on php communication, i have to run it on my local WAMP server to see it! And even in this stage, the loading of external sometimes fail when i use the unique url method!
-
AKA [ Paul Bainbridge]
Are you direct linkiing to the files(http://www) or locally linking(somefolder/image.jpg)?
-
Senior Member
-
I prefer the method described here: http://www.ultrashock.com/forums/act...s3-123408.html
Here's the interesting part of it all:
Code:
var req:URLRequest = new URLRequest( "media/flash/intro.swf" );
req.method = URLRequestMethod.POST;
req.data = true; // POST requests require non-null data
var loader:Loader = new Loader();
loader.load( req );
Worked fine for me both locally and remotely and the use of POST instead of GET seems much tidier
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|