在我的网站上使用swf加载XML文件的问题?

时间:2010-01-03 10:53:03

标签: xml flash actionscript-3 sandbox

我在我的网站上创建了一个swf。 swf加载xml数据。我在本地测试时工作正常。但是当我将它上传到服务器时,我得到一个IOErrorEvent()。为什么会这样?

以下是XML文件的代码:

<?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>///~~~~~~~~~~~~~~~~~~~~~~~

以下是加载我的xml数据的代码:

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);
    }

如何找出导致此错误的原因?让我疯狂......从上午9点到凌晨5点一直试图为网站创建这个标题,现在我陷入了XML加载错误......

编辑: 更正注释标签修复了我的xml加载问题。 然后我面对xml文件中没有显示在屏幕上的图像。当我去www.mysite / media / myFlash.swf时,图像加载完美;然而,当我去www.mysite.com时,'myflash.swf'在图片中引发了另一个错误。 我通过更改xml中的文件路径来纠正这个问题...而不是acquainted.jpg我将其更改为media / specials / acquainted.jpg。

谢谢你们重定向我并帮助解决这些问题!

2 个答案:

答案 0 :(得分:0)

使用Windows / IIS进行开发,在Apache上部署?区分大小写可能是个问题。

如果您尝试直接下载部署的Xml会发生什么?你用什么网址为xml?这是路径问题吗?

答案 1 :(得分:0)

消费者的回答可能就是这样,但我会扩大消费者的评论。

您的XML中的///可能会在您获取XML时解析XML时出错。 XML注释类似于<!-- comment here -->

相关问题