PDA

View Full Version : Simple client app runs fine out of Flex Builder, can't connect outside of it


DocWatson
08-13-2009, 06:50 PM
Hey all.

I've currently got an issue with a simple demo application I'm trying to get going on localhost. I have a simple server running on localhost listening for XML-RPC requests which works quite well. I wrote a Flash app with FlexBuilder and the as3-rpclib that can connect to the server and send and receive requests just fine, but only when I run it from FB. If I export the project as a release build and try to run it outside of FB, however, I get a security error: "Security error accessing url".

The fault itself (I took out unnecessary portions):
(mx.messaging.messages::ErrorMessage)#0
body = (null)
clientId = "DirectHTTPChannel0"
correlationId = "644077C0-2112-918D-30C8-151DC23FFD65"
destination = ""
extendedData = (null)
faultCode = "Channel.Security.Error"
faultDetail = "Destination: DefaultHTTP"
faultString = "Security error accessing url"
headers = (Object)#1
DSStatusCode = 0
messageId = "42B2B029-852C-34A2-AD05-151DC28D87A2"
rootCause = (flash.events::SecurityErrorEvent)#2
...
text = "Error #2048: Security sandbox violation: file:///C:/.../RpcDemo/RpcDemo.swf cannot load data from http://localhost:80/mytest."
type = "securityError"


I read up on the error and it seems the general consensus is to open up access using crossdomain.xml, but since I'm running both server and client on localhost how would I go about doing that? Or is there some simple workaround for this kind of situation?

Peter Cowling
08-14-2009, 08:29 AM
Use the compiler setting -use-network=false.