ActionScript Error #2148:
SecurityError: Error #2148: SWF file file:///C:/Documents and Settings/UserProfile/Desktop/flexstore/bin-release/flexstore.swf cannot access local resource myFile.swf. Only local-with-filesystem and trusted local SWF files may access local resources.
ActionScript Error #2148 can be caused by a number of reasons. If you are using Flex please keep in mind that the bin directory is a special directory that the Flash player allows SWFs ( and other files ) to load from as long as the file is stored in this directory. It will also allow a loaded swf to access network resources (a remote HTTPService call for example). If these files are placed anywhere besides the bin directory, the Flash Player prevents the file from accessing any external resources. You can allow for external access by changing the settings within the FlashPlayer or within Flex. These solutions are listed below
Fix 1 :
If you're loading in XML or other files from a remote sever that isn't hosting the SWF too, make sure you create a crossdomain.xml policy, and put it on the root of your webserver. If you haven't heard about a cross domain policy or need help creating a crossdomain.xml file click the link and I will show you how to create a crossdomain.xml file. View my tutorial on How to Create a crossdomain.xml file and visit the links on the bottom of the page to learn more.
<!DOCTYPE cross-domain-policySYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<allow-access-from domain="www.curtismorley.com" />
<allow-access-from domain="curtismorley.com" />
Within ActionScript you are now able to specify the cross domain access from within the code. I won't get into the guts of this one but if you want to learn more view the Flash / Flex documentation or Adobe LiveDocs - Security Chapter or get Joey Lott's book ActionScript 3 Cookbook By adding this code you will get rid of ActionScript Error #2148 If you are using https:// you will need to use allowInsecureDomain() as shown below. If you are using a local file make sure to target it correctly(i.e. c:\myFolder).
One hack to get rid of ActionScript Error 2148 is to add these arguments to the compiler (via Properties - Flex Compiler) : -use-network=false . Beware though this will effectively change your cross-domain security.
Make sure your Global Security Settings in Flash Player allows local access to the directory your SWF/XML is running from. At the Global Security Settings in Flash Player click on Edit locations >> Add location and then either type in the new location your SWF is at (i.e. c:\myFolder) or browse for the file or folder. Shut down Flash/ Flex and all instances of the Flash Player(including browsers), and then try again. This will eliminate this ActionScript Error #2148. This solution only works for you on your computer. If you cahnge computers or change locations on the web please refer back to Fix 1.
And now you know 2 ways to fix and 2 ways to circumvent ActionScript Error #2418: Security Error