|
-
Senior Member
[F8] Error opening URL when loading XML
Hi,
I'm trying to load some URLs from a XML file.
The .fla, .swf and .xml files are all located on my desktop.
My code for loading the XML is:
Code:
url = new Array();
function loadXML(loaded) {
if (loaded) {
for (zx=0; zx<this.firstChild.childNodes.length; zx++) {
url[zx] = this.firstChild.childNodes[zx].childNodes[0].firstChild.nodeValue;
}
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("urls.xml");
The error the outputs is:
Error opening URL "file:///C|/Documents%20and%20Settings/User/Desktop/undefined"
My XML file name is urls.xml .
The file itself appears to be loading because 2 URLs show up, while 1 does not. I have a total of 3 URLs in the .xml file.
What am I doing wrong?
Thanks in advance.
-
Senior Member
Plz try either or all of four steps mentioned below:
1. Can you trace your url[] array and check if it contains all the URLS parsed from XML;
2. Alternatively u can also trace whole XML object to see if 3rd URL is parsed...
3. Drag and drop your XML file in IE browser and check if it is well formed i.e. there are no mistakes while inserting data in XML.... for e.g. missing tags etc or using some special characters which are not parsed in flash...
4. uplooad the whole package i.e. FLA, XML etc so that we can check the problem for you
-
Senior Member
Yeah, I forgot to mention I did check if all the data was loaded. It was.
All 3.
My XML:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>http://i204.photobucket.com/albums/bb222/ShnitzelMars/ACleibocopy.jpg</image>
</pic>
<pic>
<image>http://i204.photobucket.com/albums/bb222/ShnitzelMars/Stalker4.jpg</image>
</pic>
<pic>
<image>http://i204.photobucket.com/albums/bb222/ShnitzelMars/AC3copy.jpg</image>
</pic>
</images>
I saved it as "all files", encoding UTF-8. Used notepad to write it.
The only picture that doesn't show is the first one. The last two show up perfectly.
I have a bunch of code but the one that loads them is:
Code:
if (loadPicture) {
_root["pic"+x].loadMovie(url[x]);
Total = _root["pic"+x].getBytesTotal();
Loaded = _root["pic"+x].getBytesLoaded();
if (Loaded>=Total) {
loadComplete = true;
}
loadPicture = false;
}
if (loadComplete) {
_root["pic"+x]._xscale = 25;
_root["pic"+x]._yscale = 25;
_root["pic"+x]._x = _root["pic"+(x-1)]._x+_root["pic"+(x-1)]._width+30;
x++;
loadComplete = false;
} else {
loadPicture = true;
}
-
Senior Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|