views:

178

answers:

3

I'm working on a flex app, and I have Flash & AS3 experience up to now. I have text file I need to request using URLLoader, so I placed it in the same directory as the SWF

deploy > maps > map1.txt

but when run the SWF I get the following error

*** Security Sandbox Violation ***
SecurityError: Error #2148: SWF file file:///Users/him/Documents/Clients/Geekery/Bounce/deploy/Bounce.swf cannot access local resource /maps/map1.txt. Only local-with-filesystem and trusted local SWF files may access local resources.
    at flash.net::URLStream/load()
    at flash.net::URLLoader/load()
    at com.geekery.Bounce::BounceMap()
    at Bounce/loadMap()
    at Bounce()

Which seems odd to me. Is there a special place I should be keeping files like this? Or is there some way I can allow files to be loaded form the same directory as the SWF?

A: 

Are you using a relative or absolute url? Have you tried loader.load( new URLRequest( 'maps/map1.txt' ) ) ?

jmreidy
yup, that's exactly how I'm trying to load things right now.
gargantaun
A: 

If the file is static, you can use the @Embed tag to do this. See this example.

Michael Brewer-Davis
A: 

What you need is a crossdomain.xml to set the permissions for the .swf application on the same server. More info at below links

Cross-domain policy file specification

loadPolicyFile()

If this is not really what you are looking for then you can just go for the [Embed] solution.

Daniel T. Magnusson