Search code examples
xmlflashactionscript-3sandbox

Problems loading XML file with swf on my site?


I created a swf that I have on my website. The swf loads xml data. it works fine when I test it locally. But when I upload it to the server, I get a IOErrorEvent(). Why is this occurring?

Here is the code for the XML file:

<?xml version="1.0" encode="UTF-8"?>
<menu>

<col>///~~~~~~~~~~~~~~~~~~~~~~~
<tile>
///The "thumb" tag should indicate the corresponding image. It is an image.
///The "pic" tag indicates a partial web address. It is text
///The "cap" tag is used as an identifier caption. It is text.
<thumb>acquainted.jpg</thumb>
<pic>www.mysite.com</pic>
<cap>acquainted</cap>
</tile>
</col>///~~~~~~~~~~~~~~~~~~~~~~~

Here is the code that loads my xml data:

function xml1Loaded(e:Event):void { 
    menu1XML=new XML(xmlLoader1.data);
    xmlLoader1.removeEventListener(Event.COMPLETE, xml1Loaded); 
    xmlLoader1.removeEventListener(IOErrorEvent.IO_ERROR, error1Occurred);
}

function error1Occurred(e:Event):void { 
    infoBox.text="There was an error loading an xml file. Perhaps the server is busy. Try refreshing the page.";
    xmlLoader1.removeEventListener(Event.COMPLETE, xml1Loaded); 
    xmlLoader1.removeEventListener(IOErrorEvent.IO_ERROR, error1Occurred);
    }

How can I figure out what is causing this error? Driving me crazy...been up from 9am - 5am trying to create this header for the site and now I'm stuck on an XML load error...

EDIT: Correcting the comment tags fixed my xml loading problem. I then was faced with the images within the xml file not displaying on the screen. When I went to www.mysite/media/myFlash.swf, the images loaded perfectly; however, when i went to www.mysite.com where the 'myflash.swf' was in a the images threw another error. I corrected this issue by changing the file path in the xml...instead of acquainted.jpg I changed it to media/specials/acquainted.jpg.

Thank you guys for redirecting me and helping with these issues!


Solution

  • spender's answer is probably the case but I though I would expand on spender's comment.

    Your /// in your XML will probably give you an error while parsing the XML when you do get it. XML comments are like <!-- comment here -->.