我将文件abc.swf
嵌入名为index.html
SWF文件需要访问abc.xml
abc.xml
存储在Rooms/abc.xml
index.html
存储在Schedule/index.html
在abc.swf
中,我有代码:
inforequest=new URLRequest("~/Rooms/abc.xml");
但是我收到了一个错误:
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error
我知道这是因为网址错误但我不知道如何解决这个问题。
我试过了:Rooms/abc.xml, abc.xml, ../Rooms/abc.xml
,但没有一个能奏效。
请帮忙!
修改
这是html文件:
@model Booking_Ticket_Management_System.Models.Schedule
@{
ViewBag.Title = "XmlGenerate";
}
<h2>Choose your seats</h2>
<object width="500" height="600">
<param name="movie" value="~/Rooms/@Url.Content(Model.Room.Map)"/>
<embed src="~/Rooms/@Url.Content(Model.Room.Map)" width="500" height="600"/>
</object>
答案 0 :(得分:2)
试试这个,
var myRequest:URLRequest = new URLRequest("../abc.xml");
答案 1 :(得分:2)
养成总是添加至少2个侦听器的习惯:完全 - 通常由所有人添加,IOErrorEvent通常被所有人跳过:)
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderHandler, false, 0, true);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderHandler, false, 0, true);
loader.load(new URLRequest("path/to/image.jpg"));
//...
protected function libLoadHandler(e:Event):void
{
var loader:Loader = (e.target as LoaderInfo).loader;
if(e.type == Event.COMPLETE || e.type == IOErrorEvent.IO_ERROR)
{
//unregister both as COMPLETE and IO_ERROR are "finishing" events
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, loaderHandler, false);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, loaderdHandler, false);
//do something after event based on event type
}
}