PDA

Click to See Complete Forum and Search --> : XML.loaded inconsistent



vmmc
04-20-2001, 11:46 AM
I've found that XML.loaded is inconsistent with its results. It works fine when you're running a movie locally, but I've never gotten it to return TRUE on a .swf file I loaded online.

Has anyone else had a similar problem?

percepi
06-07-2001, 10:27 AM
I had the same problem, and it drove me nuts, until I traced it very thoroughly and realized that it wasn't the xml.loaded, but my code that was supposed to wait for it to do so.
This is what entually worked for me:

// frame 1
gXML = new XML();
gXML.load("g.xml");
trace (" about to load g");
var counter = 0;
explain = "Glossary data loading, please wait...";

// frame 2, blank

// frame 3
trace("in frame 3");
if (not gXML.loaded) {
counter++;
trace ("g not yet loaded "+ gXML.status);
if (counter<5000) {gotoAndPlay (2);}
} else {
trace ("g data loaded!"+gXML.status);
}

// frame 4
trace("in frame 4");
if (counter>=5000) {
explain = "Error: unable to load g.";
stop();
} else {
explain = "G loaded.";
}


Try this with a local xml file and you'll see typically only one entry into frame 3. But put it over a slow connection, and frame 3 gets entered several times.

Hope this helps!