This is my main folder structure: http://i.stack.imgur.com/l1YnV.jpg
My code is as follows:
private var xmlLoader:URLLoader=new URLLoader(); private var url:URLRequest=new URLRequest("../src/NPClist.xml"); xmlLoader.load(url);
I get the following:
Error
No matter how much "../" I paste into the URLRequest constructor, it only works if NPClist.xml is in the same folder as .swf (bin-debug), and I even tried to copy it. It appears to be ignoring / not allowing "../". I also tried to export the release build, but that didn't work. Interestingly, Embeds works the same way (the resource folder is at the same level as src and bin-debug).
[Embed(source="assets/mainmenu/somefile.png")]
Here's how I got it to work:
var xmlFile:File=new File(File.applicationDirectory.nativePath).resolvePath("../src/NPClist.xml"); var url:URLRequest=new URLRequest(xmlFile.url);
"../" did not work initially, but it works if you use it like that.
Returning to this, this also seems wrong. Here, how it definitely works, as expected:
I have included assets with the installer and I use
imgFile=File.applicationDirectory.resolvePath("assets/folder/file"); urlReq=new URLRequest(imgFile.nativePath); ldr.load(urlReq);
source share