PDA

View Full Version : Reloading a loaded XML object


MochaLover
03-28-2003, 02:55 AM
Hi,

I am doing a XML-based guestbook with ASP. I have the following codes in the 1st frame. ReadXML() is a prototype that will read the XML object and populate the fields of the guestbook.

Code:
var GuestBook = new XML;
GuestBook.ignoreWhite=true;

GuestBook.onLoad=function(sucess) {
if (sucess) {
GuestBook.ReadXML();
gotoAndPlay(3)
}
}
GuestBook.load("GuestBook.xml");


My problem is: when an entry is submitted, the ASP inserts the entry into the XML, I try to reload the XML object by going to the above frame. It is however, not re-loaded, even though I have the new XML command.

Am I doing it wrongly? Or is there a better way?

Help please!

Thanks in advance.

CyanBlue
03-28-2003, 03:32 AM
Howdy...

I think you should show us that ReadXML() function as well... ;)

MochaLover
03-28-2003, 04:18 AM
Thanks CyanBlue for the reply,

I just found the answer in http://tupps.com/flash/faq/xml.html#4-G.

It was a cache issue..I did the following and it works fine now:

unique=new Date().getTime()
GuestBook.load("GuestBook.xml?unique="+unique);

CyanBlue
03-28-2003, 11:37 AM
Yup... That's where I was heading to... ;)

Use one liner...
GuestBook.load("GuestBook.xml?uniqueID=" + getTimer());

:D

monsoon
12-13-2005, 03:22 AM
as a slight improvement to this...
the following method is not only more reliable but it allows the user to accept cached xml between your xml modifications so it's more efficient too.

you can get the date and time that your xml file was last modified using some some asp/php in the page hosting the swf.

then pass it in to flash via the object tag filenames. eg:
"myMovie.swf?dtm=<%=dtm%>" <!-- that's an asp example -->

(remember to url encode it first though)

then in your flash code you just attach that variable to the xml request string instead of a random number.

(again, you'll need to url encode it first)

CyanBlue
12-13-2005, 03:11 PM
The problem with that method is that the string size is limited to about 1k... So, it might be good if you have small data to transfer... ;)