PDA

Click to See Complete Forum and Search --> : Replaying movie does not reload XML files



cathl
06-28-2001, 10:47 AM
Hi, I am new to Flash and XML.

I have read most of the posts here and still can't work out how to get Flash to reload an XML file.

I have a Flash movie embedded in an html page which calls a PHP script which reads from a database and creates an XML file with the data from the database.

My Flash movie then reads the data from the XML file. If I change the data in the database and refresh the html page the XML file changes but the data shown in the movie is still the old data.

I have tried using XML.onLoad and XML.loaded to verify that the XML file has been loaded but this has no effect.
Can anyone help?
Thanks.

VAYKENT
06-28-2001, 03:44 PM
How sure are you that Flash is the link that's failing you?? Are you sure that the PHP script is being called? Are you sure that the PHP script is getting new data?? Are you sure that the new data is being written OVER the old data??

I'd try to verify all of this before wondering if Flash is messin' you up - not because Flash is infallible, but because what you're doing in Flash seems easier than what you're doing in PHP...

You also need to realise that Flash's XML loading is not syncronous.. in other words... you can't say, "Load!!", and have it 'poof!!' load... it will load the XML when ever it gets done.. so if you're trying to access the data from the loaded XML.. you'll need to make sure it's done.. which I guess you've tried to do by using .onLoad and .loaded...

Alright.. you've stumped me.. Do you have to clear out your internet cache to notice changes??? (Yeah... I'm stretchin' here)

tupps
06-28-2001, 06:30 PM
You might also have a problem with your database taking some time. Eg if you submit to the DB and then immediately load the XML you may have read the database before the changes are reflected.

One other thing to try is to make sure that there isn't a proxy server between you and the web server that is caching the php scripts.

Thanks

Luke

cathl
06-29-2001, 07:48 AM
Thanks for your help, I tried your suggestions:
If I change the data in the database then run the movie I can then look at the XML file to check it contains the updated data and it does, so that wasn't the problem.
However if I clear my browsers cache (I'm using IE5) then refresh the html page I can see the changes.
I have found and added the tags that stop Netscape caching swf files in html pages and this works fine, but I can't find one for IE, so I'm still stuck because this application is for use over the web.
Any suggestions yet again?

VAYKENT
06-29-2001, 12:29 PM
I seem to remember reading something somewhere (yeah, I know!).. something about information in the header of an html file that told the client computer how long the document was supposed to remain in cache... before it was considered 'old'... (Considered 'old' would cause the client computer to ask for a fresh version....)

There's got to be something out there - I just don't know where.... tupps?? Do you know???

cathl
07-03-2001, 06:53 AM
Thanks for all your help.
I've solved the problem using random numbers everywhere to force the file to be loaded from the server.
Cheers,
Cath.

Paulo Parola
07-03-2001, 11:04 AM
Hi,

I have encountered the same problem as you with the Flash not being updated with the new data.

Indeed, the only way Flash starts seeing the changes in the XML is after the local cache is cleared and the movie is reloaded from the server.

But I don't want to reload the Flash movie every time (this 'solves' the problem), since it is almost 80KB size.

So how should I solve this? What was exactly your solution with random numbers? Are you everytime reloading the movie from the server (that is, not using a cached copy?) ?

Any help would be greatly appreciated....

tupps
07-03-2001, 11:59 AM
The random number solution is simply trick the browser/proxy server into thinking it is getting a new file, because the URL has changed.

For example if I am loading:

http://www.tupps.com/flash/news.xml

And this file is changing the browser will see the request for the URL and know that it is the same one and will not make an update.

If I change the URL to be:

http://www.tupps.com/flash/news.xml?random=12845743890527

Where the last number is random. For the web server it will simply ignore this random=12923434 number, as it is just a file. However the browser and proxy servers are unable to determine that this is the same as the file before and will be forced to reload the file, as they are not able to determine that the files are the same.

Hope this explains it.

Thanks

Luke