# Updating Dynamically loaded Content

**URL:** <https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980>\
**Category:** flash\
**Created:** [August 5, 2004, 8:54am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980 "2004-08-05T08:54:57Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![mystique](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@mystique](https://forum.kirupa.com/u/mystique)\
**Post date:** [August 5, 2004, 8:54am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/1 "2004-08-05T08:54:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 12:05am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/2 "2004-08-06T00:05:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 1:45am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/3 "2004-08-06T01:45:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 1:53am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/4 "2004-08-06T01:53:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 2:17am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/5 "2004-08-06T02:17:08Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 2:43am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/6 "2004-08-06T02:43:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 2:47am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/7 "2004-08-06T02:47:52Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 2:54am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/8 "2004-08-06T02:54:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 3:08am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/9 "2004-08-06T03:08:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 3:41am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/10 "2004-08-06T03:41:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 3:46am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/11 "2004-08-06T03:46:43Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 3:48am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/12 "2004-08-06T03:48:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 3:56am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/13 "2004-08-06T03:56:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 4:01am UTC](https://forum.kirupa.com/t/updating-dynamically-loaded-content/59980/14 "2004-08-06T04:01:04Z")

</div>

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