How to pass parameter to AS2 movie and still use browser's cache?


I am loading an AS2 movie from AS3, and would like to pass a parameter to it. The value of the parameter will be different each time.

The loaded movie is quite big, and I need it to be loaded from the browser’s cache.

However, everything I have tried appends the parameter as a query string, which is a problem because then it won’t load the movie from the browser’s cache, since the browser recognizes it as a “different” file to load.


var urlVars:URLVariables = new URLVariables();
urlVars.myvar = "randomvalue";

var urlReq:URLRequest = new URLRequest("child.swf"); = urlVars;

var ldr:Loader = new Loader();
ldr.load(urlReq, addedDefinitions);

The problem is, this will make a request that looks like:


Since myvar is assigned a different random value for each call, it doesn’t end up loading child.swf from the browser’s cache.

Is there any way to load the file as just “child.swf”, and pass myvar as a FlashVar (or whatever the equivalent is in AS3)? Ideally, the variable would be available to the child movie as _root.myvar.

I can do this from the HTML webpage (using FlashVars), but I can’t seem to do it in AS3 directly.

Thank you!
p.s. I tried using: urlReq.method = URLRequestMethod.POST;
But that seems to cause it not to use the browser’s cache either.