Reputation: 599
I have a file abc.swf
embed in a html file called index.html
The SWF file needs to access abc.xml
The abc.xml
is stored in Rooms/abc.xml
The index.html
is stored in Schedule/index.html
In the abc.swf
, I have code:
inforequest=new URLRequest("~/Rooms/abc.xml");
However I got an error:
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error
I know this is because the URL is wrong but I dont know how to fix that.
I've tried: Rooms/abc.xml, abc.xml, ../Rooms/abc.xml
but none of them worked.
Please help!
EDIT:
This is the html file:
@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>
Upvotes: 1
Views: 125
Reputation: 6258
Get into habit to always add at least 2 listeners: Complete - which normally is added by all, and IOErrorEvent which normally is skipped by all:)
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
}
}
Upvotes: 2