Advanced flash question

Out of context: Reply #3

  • Started
  • Last post
  • 3 Responses
  • 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.

View thread