A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [F8] Error opening URL when loading XML

  1. #1
    Senior Member Shnitzel's Avatar
    Join Date
    May 2007
    Location
    IL
    Posts
    130

    [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.

  2. #2
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831
    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
    As ever,
    Vinayak Kadam

  3. #3
    Senior Member Shnitzel's Avatar
    Join Date
    May 2007
    Location
    IL
    Posts
    130
    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;
    	}

  4. #4
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831
    Can u upload the FLA ?
    As ever,
    Vinayak Kadam

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center