# AS3 - Unable to load local XML file due to security error

**URL:** https://forum.kirupa.com/t/as3-unable-to-load-local-xml-file-due-to-security-error/224527
**Category:** flash
**Created:** [May 3, 2007, 2:08am UTC](https://forum.kirupa.com/t/as3-unable-to-load-local-xml-file-due-to-security-error/224527 "2007-05-03T02:08:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ajax](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@ajax](https://forum.kirupa.com/u/ajax)
#### Post date: [May 3, 2007, 2:08am UTC](https://forum.kirupa.com/t/as3-unable-to-load-local-xml-file-due-to-security-error/224527/1 "2007-05-03T02:08:31Z")

</div>

Hi,

I am trying to create a simple SWF in AS3 that will read some data from a local (i.e. on my machine) XML file but when I try to load the file using a URLLoader object and a URLRequest object, a security error is thrown and I am unable to open the file.

Eventually I will post this SWF on a web server and the XML doc will also be on the same web server, not on my local machine, but I wish to run it on my machine for testing/development purposes.

note: I am compiling this AS3 SWF with the Flex 2.0.1 SDK mxmlc.exe AS3 compiler as I do not have Flash CS3.

\>\>

It appears the problem is that the [COLOR=Blue]Security.sandboxType[/COLOR] property is being set to:[INDENT]_[COLOR=Black]localWithNetwork[/COLOR]_  
[/INDENT]whereas I really want it to be set to:[INDENT][COLOR=Black]_localTrusted_[/COLOR]  
[/INDENT][COLOR=Black]\>\>[/COLOR]

Having read through the ActionScript 3 security docs, I have tried to modify the **mms.cfg** file but this file does not exist anywhere on my system!

I do, however, have the following Flash Player security files:[INDENT]C:\WINDOWS\system32\Macromed\Flash\*_FlashAuthor.cfg_\*  
C:\Documents and Settings[MyUserName]\Application Data\Macromedia\Flash Player#Security\*_FlashAuthor.cfg_\*  
[/INDENT]And in both of these files the only setting is:[INDENT]_LocalSecurityPrompt=Author_  
[/INDENT]\>\>

My AS3 code is:[COLOR=Red]  
[/COLOR][INDENT][COLOR=Red] …[/COLOR]

[COLOR=Red] // main class[/COLOR]  
[COLOR=Red] public class OpenXMLFileSample extends TopLevel[/COLOR]  
[COLOR=Red] {[/COLOR]  
[COLOR=Red] public function OpenXMLFileSample() [/COLOR]  
[COLOR=Red] { [/COLOR]  
[COLOR=Red] // add the stage in TopLevel to the display list[/COLOR]  
[COLOR=Red] stage.addChild( new Output( stage ) );[/COLOR]

[COLOR=Red] // load the XML doc[/COLOR]  
[COLOR=Red] var \_urlMenu:URLRequest = new URLRequest( “xml/menu01.xml” );[/COLOR]  
[COLOR=Red] var \_ldrMenuXMLFile:URLLoader = new URLLoader();[/COLOR]

[COLOR=Red] // try to open the XML doc[/COLOR]  
[COLOR=Red] try[/COLOR]  
[COLOR=Red] {[/COLOR]  
[COLOR=Red] \_ldrMenuXMLFile.load( \_urlMenu ) [/COLOR]  
[COLOR=Red] }[/COLOR]  
[COLOR=Red] catch( error:SecurityError )[/COLOR]  
[COLOR=Red] {[/COLOR]  
[COLOR=Red] Output.trace( “A SecurityError occurred when trying to open the XML menus doc.” ) [/COLOR]  
[COLOR=Red] }[/COLOR]

[COLOR=Red] } // end constructor: Main[/COLOR]

[COLOR=Red] } // end public class[/COLOR]

[COLOR=Red] …  
[/COLOR][/INDENT]Which when run, outputs:  
[COLOR=Black]“A SecurityError occurred when trying to open the XML menus doc.”  
is output.  
[/COLOR]  
\>\>

My Flash Player settings are :[INDENT][COLOR=Blue]flash.system.Capabilities.version[/COLOR]  
_WIN 9,0,28,0_ on _XP Pro_  
[/INDENT][INDENT][COLOR=Blue]flash.system.Capabilities.localFileReadDisable:[/COLOR]  
_false_

[COLOR=Blue]flash.system.Capabilities.isDebugger:[/COLOR]  
_true_

[COLOR=Blue]flash.system.Security.sandboxType[/COLOR]:  
_localWithNetwork_  
[/INDENT]\>\>

1. Does anyone know how to fix this problem ?

2. Is it unusual not to have a **mms.cfg** file ?
