I am using Flash 8.
I took the example from within the Samples that Flash supplies. The problem I am having is that the XML file that is being loaded seems like it is being cached. Can anyone see what I am doing wrong.
Here is my actionscript:
I took the example from within the Samples that Flash supplies. The problem I am having is that the XML file that is being loaded seems like it is being cached. Can anyone see what I am doing wrong.
Here is my actionscript:
Code:
var guestbook_ta:mx.controls.TextArea;
// create an XML object instance which is used to load comments from a remote server.
var my_xml:XML = new XML();
var guestbook_xml:XML = new XML();
guestbook_xml.ignoreWhite = true;
guestbook_xml.onLoad = function(success:Boolean) {
if (success) {
var numEntries = this.firstChild.childNodes.length;
// loop through each of the entries from the XML packet...
guestbook_ta.text += "Number of Entries:"+numEntries+"<br>";
for (var i = 0; i<numEntries; i++) {
// create a shortcut to the current child node
var entry_xml:XMLNode = this.firstChild.childNodes[i].childNodes;
/* set local variables for the name, email address, url, comments and timestamp.
Since you know the structure of the XML packet, you know the index of each of these child nodes. */
var name_string:String = entry_xml[1].firstChild.nodeValue;
var emailaddress_string:String = entry_xml[2].firstChild.nodeValue;
var url_string:String = entry_xml[3].firstChild.nodeValue;
var comments_string:String = entry_xml[4].firstChild.nodeValue;
var datetime_string:String = entry_xml[6].firstChild.nodeValue;
var entry_string:String = "";
entry_string += "<span>"+name_string+"</span><br>";
entry_string += "<span>"+emailaddress_string+"</span><br>";
entry_string += "<span>"+url_string+"</span><br>";
entry_string += "<span>"+comments_string+"</span><br>";
entry_string += "<span>"+datetime_string+"</span><p>";
entry_string += "<img src=\"line_gr\"><br>";
// append each current entry to the current value of guestbook_ta
guestbook_ta.text += entry_string+"<br>";
}
} else {
trace("error loading XML");
}
};
// load the guestbook XML entries from the remote server.
my_xml.sendAndLoad("[URL unfurl="true"]http://localhost/Flash8/DatabaseExamples/Guestbook2/gb_select.xml",[/URL] guestbook_xml);