Copy link to clipboard
Copied
I am attempting to load an XML file using AS3. I have seen several topics similar to my question, but none seem to fit my situation. My code snippets follow.
public function loadDirectory():void {
trace("THERE")
var setUpLoader:URLLoader = new URLLoader();
setUpLoader.addEventListener(Event.COMPLETE, setupLoaded);
setUpLoader.load(new URLRequest("xml/setup.xml"));
}
private function setupLoaded(e:Event) {
_setUpXML = XML(e.target.data);
trace("HERE "+_setUpXML)
completeLoading();
}
Between the THERE trace and the HERE trace, I get the following error messages:
Error #2044: Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type.
Error #2044: Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type.
The initial snippet of my XML file is:
<?xml version="1.0" encoding="utf-8"?>
<setUp>
<setdata rootdir="http://aln.coe.ttu.edu/anderson/T-Model11-0/" server="true" />
<fonts> Arial,Helivetica,_sans </fonts> //--Font
<fontsize> 12 </fontsize> //--Font size (Do not change)
The threads I have followed suggest the problem is using a Loader rather then a URLLoader. But, my code uses the URLLoader. Any suggestions are appreciated.
while testing 'trust' your loading swf, Adobe - Flash Player : Settings Manager - Global Security Settings panel
Copy link to clipboard
Copied
check if your xml is malformed.
Copy link to clipboard
Copied
It actually comes through and the remaining code processes it as properly formed XML when I compile my code. But, when I load the complied (swf) files on a server and execute them through a browser, it locks up. I think this error is locking up the browser.
Copy link to clipboard
Copied
Add a listener for the IOErrorEvent, that might give you more details. Also set Allow Debugging in Publish Settings, so you can see the line number where the error happens. You could also then do a debug test movie, and see what the variables contain.
Here's the IOError listener:
setUpLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
and:
private function ioErrorHandler(event:IOErrorEvent):void {
trace("ioErrorHandler: " + event);
}
Copy link to clipboard
Copied
When I added your code, I got nothing. But when I turned on the debugger, I got:
*** Security Sandbox Violation ***
Connection to http://aln.coe.ttu.edu/anderson/T-Model11-0/spages/authorize.cfm?UName=guest&passWord=guest halted - not permitted from file:///C|/Users/Ed%20Anderson/Documents/T%2DModel11%2D0/tmodel11%2D0.swf
-- Untrusted local SWFs may not contact the Internet.
SecurityError: Error #2028: Local-with-filesystem SWF file file:///C|/Users/Ed%20Anderson/Documents/T%2DModel11%2D0/tmodel11%2D0.swf cannot access Internet URL http://aln.coe.ttu.edu/anderson/T-Model11-0/spages/authorize.cfm?UName=guest&passWord=guest.
at flash.net::URLStream/load()
at flash.net::URLLoader/load()
at Login::Login/submitLogin()
Cannot display source code at this location.
Debug session terminated.
It appears that I have some sort of security issue. Any ideas?
Copy link to clipboard
Copied
while testing 'trust' your loading swf, Adobe - Flash Player : Settings Manager - Global Security Settings panel
Copy link to clipboard
Copied
Thanks!!
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now