Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML file is not refreshing

Status
Not open for further replies.

ksbigfoot

Programmer
Apr 15, 2002
856
CA
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:
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);
 
I'm following this thread using this link -
and by using oldnewbie's answer
// Or...

loadVarsText = new LoadVars();
loadVarsText.load("nocache.txt?kill="+kill);
...

could this be then applied to ANY xml? For example a menu system? copying and pasting it "before" the rest of the xml eg:

Code:
<?xml version="1.0" encoding="UTF-8"?>

loadVarsText = new LoadVars();
loadVarsText.load("nocache.txt?kill="+kill);loadVarsText = new LoadVars();
loadVarsText.load("nocache.txt?kill="+kill);

<!DOCTYPE eyeimages SYSTEM "./anim_imgs">
<eyeimages speed="5" fadespeed="9" 
	defaultimg="./anim_imgs/dyna/dynastart.jpg"
	defaulturl="./dyna_main.html">	
	<image order="1" actiontext="-- learn more">
		<src>./anim_imgs/dyna/dyna001.jpg</src> 
		<small>./anim_imgs/dyna/dyna001sm.jpg</small>
		<target>./GyroBall.html</target> 
		<heading>GyroBall™                          Pro Plus™   SpeedMeter™</heading> 
		<subheading>Amber • Blue • Green</subheading>
	</image>
	<image order="2" actiontext="-- learn more">
		<src>./anim_imgs/dyna/dyna002.jpg</src> 
		<small>./anim_imgs/dyna/dyna002sm.jpg</small>
		<target>./docking.html</target> 
		<heading>Docking Station                  For Easy StartUp</heading> 
		<subheading>• Easy Start for your Gyro!</subheading>
	</image>
	<image order="3" actiontext="-- learn more">
		<src>./anim_imgs/dyna/dyna003.jpg</src> 
		<small>./anim_imgs/dyna/dyna003sm.jpg</small>
		<target>./dynamax.html</target> 
		<heading>DynaMax                      Bigger • Stronger • Better</heading> 
		<subheading>The Ultimate Power</subheading>
	</image>
</eyeimages>

or I a flv player list
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<videos>

loadVarsText = new LoadVars();
loadVarsText.load("nocache.txt?kill="+kill);loadVarsText = new LoadVars();
loadVarsText.load("nocache.txt?kill="+kill);

<video url="1.flv" desc="1a" title1="1b" time1="1c" info1="1d" files1="1e" />
<video url="2.flv" desc="2a" title1="2b" time1="2c" info1="2d" files1="2e" />
<video url="3.flv" desc="3a" title1="3b" time1="3c" info1="3d" files1="3e" />
<video url="4.flv" desc="4a" title1="4b" time1="4c" info1="4d" files1="4e" />

</videos>

or a text driven
Code:
<whatshappening>

loadVarsText = new LoadVars();
loadVarsText.load("nocache.txt?kill="+kill);loadVarsText = new LoadVars();
loadVarsText.load("nocache.txt?kill="+kill);


	<JAN title="JANUARY 2006">
	</JAN>
	<FEB title="FEBRUARY 2006">
		<event eventdate="Friday-Saturday, Feb 17-18, 2006">
			<p class='title'>SHUT-IN</p>
			<p class='title'>8:00pm until 8:00am</p>
			<p class='eventlocation'>All Elders, Deacon, Ministers and CFFC Members are invited to the Presbytery Shut-in.</p>
		</event>
		<event eventdate="Sunday, February 26, 2006">
			<p class='title'>STEWARDSHIP Session</p>
			<p class='title'>6:00pm CFFC Sanctuary</p>
			<p class='eventlocation'>Pastor Emile Banks will teach on the topic a^??Investing for $100.a^??  All are welcome to attend. 
			</p>
		</event>
</whatshappening>
	</FEB>
would that work?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top