Updating Dynamically loaded Content

Hello all,

Well im new to actionscripting but programming isnt very new to me, ive had javascript experience and know how object/class oriented AS is and how general working concepts flow…etc

But enough of me, here is my problem. I set up empty movie clip containers to hold my external .swf files when i load them in. I have 9 different external files that all load correctly. My issue is that when people view my website and cache the files after dynamically loading them, my changes that i make and upload dont take effect because their computers just pull the cached files from the last time they viewed it. This is critical for my site to work because of the amount of text updating and news that i do on it.

Thanks in advance for help,

Scott

Add a random number or the date to the end of the name for the file you are loading ie.
One of the files is called myFile.swf
Put this in flash:
loadMovie(“myFile.swf?”+Math.random()*1000);

that should give you enough different files that whenever they load your movie they will get the newest version

with the Math.random thing how would i specify the button to load the file if its going to be some random number, or will it just point to the right file

the date thing may work but it would be annoying to update every time

The question mark after the file name makes the browser think it is sending a variable to the program, the to be loaded Flash file in this case, it will load the file that is before the question mark no problem, the only thing the random number does is make it new when compared to the cached version.

seems like the idea would work, but im loading into an empty movie clip container

i copied your code like you wrote it and put it ont he buttons actionscript and it gave me an error message of “cant load file”

hmmmm should have worked, I must have forgotten to include something, unfortunately I don’t have access to flash right now, and it’s gonna be a couple of days before I do, let me see what I can find…thanks for your patience

movieHolder.loadMovie(“movieBiengLoaded.swf?param=” + (new Date()).getTime());

okay all I changed was the path from an AS file I now works, this one uses the date so it will alwyas be different

with the Math.random isertion to the file name its looking for that specific file

my case was something like “unable to open file about.swf818.92037502395”

your going to have to use the date method:
theMC.loadMovie(“theFile.swf?param=” + (new Date()).getTime());

just make sure you have the “?” in there or it won’t work, I think the random method was like this;
theMC.loadMovie(“theFile.swf?param=” + Math.floor(Math.random()*1000);

That way you don’t get the point (".") in the variable

Error opening URL “file:///C|/Documents%20and%20Settings/Scott/My%20Documents/Flash/fallout%20project/about.swf?param=1091761631750”

still dumping out on me, its still trying to open that absolute file name i think

try it on an absolute filename? like http://yoursite.com/flashfile.swf?time=124124?
this works for php and xml files…

yah i know how xml and php deal with it because they are trying to fill variables when you give the time=12312 function, flash is looking for a file name that includes time=12312 (as far as i know)

yeah have u tried it with http:// ?
mine works…
http://angeldreamz.fakedevil.com/menu2.swf?time=213
http://angeldreamz.fakedevil.com/menu2.swf?time=123214

that would most likely work, but i need ot to load empty movie clip so the page wont change and interrupt the sound files (full song mp3’s)

i know this was poor design but its my first go at a website, i just started flash like 7 weeks ago so i figured it might work

??
try
container.loadMovie(“http://yoursite.com/file.swf?param=” + (new Date()).getTime());