Advanced flash question
- Started
- Last post
- 3 Responses
- ilovemywork
Hello all... im having difficulties with a client site of mine. The thing is, the complete website was made in flash mx with and extensive content management system behind it. Some parts of this website load .jpg and .txt files from their server.
So far so good.
Now the problem is: When the client or myself updates this website trough the CMS the files are changed perfectly BUT the website still keeps showing the old pictures when i refresh. I know that that's because the text and images are loaded in my browser cache. But how can i make sure that the website completely loads again on refresh with the new pictures and text? Thanks!!
- unfittoprint0
include a random number in fornt of your loadMovie, XML load, LoadVars, Sound load objects...
In this case a number representing the current date:
// create date object
now = new Date();
nocacheStr = "?" + now.getTime();
this.loadMovie("test.swf" + nocacheStr);
- MACAS00
You build and extensive backend, then, I don't get the question then.
- SmilingBuddh0
This code will replace the loadMovie function with a new one that will automatically prevent caching:
var mcp = MovieClip.prototype
mcp.oldLM = mcp.loadMovie;
mcp.loadMovie = function(url) {
var r = (this._url.charAt(0) == "f")?(""):("?r=" + getTimer())
this.oldLM(url + r);
}The function will add a 'random' number if you're not testing the file. (for a PC, you may have to replace the "f" with your drive name; trace (this._url) and replace the 'f' with whatever is first in the trace string.
I just used this in a project; saves a lot of grief when there are multiple loadMovie commands used.