Click to See Complete Forum and Search --> : Flash doesn't refresh source XML file

04-25-2001, 10:20 PM
Okay, here's the skinny. I have a Flash file that loads an XML file, cleans out any unwanted empty nodes, parses it into an array and then has display functions on the array that can be called. The source file is an XML file that has embedded Cold Fusion tags. The server is set to have Cold Fusion interpret files of XML type, so all is peachy. I can successfully have the XML file pull data from the database, format it, get it loaded, parsed, and displayed within Flash.

The real problem is that when I change the data in the database, Flash consistently pulls the version of the page from cache instead of the dynamically created page.

As a related problem, if I update a Flash file on my website, the old one gets pulled from cache there, too.

I can work around it by calling up the dynamically created XML file, hitting Refresh, then returning to the Flash file which then loads the new (uncached) data. This is a bit impractical when you're using Flash to build a dynamic database interface.

Anyone have any idea how to get around the caching problem? I used to have the same problem with certain HTML order forms, but the META tag set to always have the page count as expired solved that. I don't know if there's a way to indicated an XML file should not be cached.

Thanks for any help.

05-01-2001, 07:39 PM
Call the xml by a php script:

Then call the php by:
urlXML.load("thescript?" + random(999));

That works. you can do sorta the same thing with the actual movie so it doesn't get cached.

05-01-2001, 08:41 PM
server provides a 304 (Not Modified) response if the file has not changed, since it's a dynamic page I would think wbserver/cold fusion would re-deliver the page not this response.
(but if you can verify that it would be good.)

But if the browser catch is set to only check once per session, it will not even make the request. In that case if you make a url rewrite so you can request 888mypage.html
and still just have the server return mypage.html
then the browser should be convinced to re-request the page.

it may work with just mypage.html?fake888, like snowdude says, it seems likely, and would be eayser than a url rewrite directive on the server.

06-04-2001, 11:13 PM
This still isn't working for me. I've been kicking myself silly trying to get this to work.

It gives the most inconsistant results ever!

Any other ideas?


06-04-2001, 11:41 PM
need details What did you try?

passing fake paramaters
setting no-catch headers at the appserver or webserver level
using a url rewrite module in the web server

06-04-2001, 11:57 PM
Sorry, i was a littl sparse.

Here is what i'm trying to do:

1) download XML from the server
2) modify the XML in flash
3) upload XML back to the server
4) update the database
5) go back to step 1

Everything works great, except going back to step one. After I've changed the data on the server, I simply gotoandplay(1). Frame 1 loads the data again.

The problem is identical to darktortoise's problem. It doesn't get the latest data.

I have tried the random string on the end of the URL, the various meta tags to expire the HTML page. I have tried various things with calling the new xml() code multiple times.

I'm starting to think it's a timing issue. I think what might be happening is that it jumps back to frame 1 before it finishes updating the database. I'm going to play around with that.

If you have any suggestions. PLEASE let me know, help me solve this and I'll give you a free training account on SecretAgents.com. The latest tutorials I'm working on shows you how to use XML without ever having to do any parsing. It's VERY cool, if only i could get this one last thing working!

Steve Nelson

06-05-2001, 12:32 AM
The random string always seems to work for me, i usually add the . You might not be loading the reloading the script each time, but I sorta doubt that and i'm sure you've gone over that part extensively. One test you can use is to follow the browser's cache. Just delete all the files before you load your site then follow along as each script is loaded as you progress through the site. Even with all the meta tags and php/whatever header no cache tags IE 5.5 still caches most except they will have an expired date previous to current date. You can then copy the files from the cache into some other directory, then open them with notepad and see what the xml looks like - as you go along. No matter what type of file it is you can still view whatever content is on script - minus the coding. If your using the random variable and two different files with different ending's ie something.html?ran=435 and something.html?ran=963 and have different xml printed out on them then you have two different files and different content should have been loaded into your site.

Another way you can test it is to run it locally on your machine within the "Control Test Movie" thing and watch the variables as they appear- this works well except you have to rename all your scripts http://localhost/something.something. Then you can watch the new data get loaded into your movie. (You have to have some type of server on you local machine though). You can view the cache with this method as well except if your using all the no cache headers and meta's they shouldn't appear.

Well just some extra thoughts that might help.

06-05-2001, 12:47 AM
I think i figured it out.

What was happening (i think) is that I was using the loadvariablesnum() function to send the XML back to the server, then downloaded the data again.

The problem was that i was updating a lot of records and that page took longer to run than the page that downloaded the records.

So, I was a matter of timing.

What I did was add a frame to the movie to send the user to after they synchronized with the database. Then they click a button to download the data.

Worked like a charm. Thanks for your help guys!

Steve Nelson

06-05-2001, 09:11 AM
with XML.sendandload, you can assign a function to handle the returned data, and not worry about frame timing.

with loadvariablesnum I pre-set one of the variables that I expect to come back like data = "wait"
then on the next frame.
if (data == "wait") {

you can then have a nice downloading animation run until you get your data.

(I also put in a maximum time to wait and re-send the data if it fails, it's should not happen but It does more than I would expect, and with this method you leave your movie locked in a loop unless the server responds)

06-05-2001, 10:41 AM
oooh! very cool idea!

i've only messed around with the sendandload() function.

It didn't seem have a variable name attached to the form data that was sent which makes it an unstandard way to deal with on the server side, and frankly a pain in the ass.

What do you do about that?

Steve Nelson