MelloYello
05-26-2008, 01:54 AM
I'm a Java developer who just recently started playing with actionscript3 / flash and have been really enjoying.
I've started making a flash based game, and decided I wanted to add network support to it. To learn the initial ropes of the networking side of flash I decided to make a test page that would act as a chat room. Everything works perfect if I'm on my own box...but if its anywhere else a security sandbox error is throw and the swf doesn't connect. This flash security policy stuff is kicking my butt all over the place. :confused:
This is what I have...
-Tomcat running on port 80, serving the swf file
-a java socket server running on port 8080 that keeps all the connections and broadcasts messages as needed (for a new person entering / leaving the channel)
So I think I understand that since the swf is on port 80 from my IP that it needs a cross domain policy to be able to access the socket on port 8080. I know theres a socket or http based request methods, I would prefer to do it via http.
I put the file "crossdomain.xml" file in my root directory of the webserver, so that http://xx.xx.xx.xx/crossdomain.xml will actually display in the broswer.
I've put the load policy file directly before the socket creation / connection...ex:
Security.loadPolicyFile("http://xx.xx.xx.xx/crossdomain.xml");
mySocket = new Socket();
I type the url pointing to the html file flex created:
http://xx.xx.xx.xx/test.html
into IE to display the swf. Like I said...everything works perfectly opening multiple client connections on my computer. Anything off my computer (lan or internet) will not work though...everything comes back with a security error. (Error #2044: Unhandled SecurityErrorEvent:. text=Error #2048: Security sandbox violation).
Just in plain frustration I tried calling Security.allowDomain("*") which I dont think I need...but that too failed.
Any suggestions on how to get this http request policy working would be greatly appreciated...I guess in the mean time since I'm somewhat at a deadend I'll try the socket based policy request...but I would like to know what exactly I did wrong for the http one. Thanks.
I've started making a flash based game, and decided I wanted to add network support to it. To learn the initial ropes of the networking side of flash I decided to make a test page that would act as a chat room. Everything works perfect if I'm on my own box...but if its anywhere else a security sandbox error is throw and the swf doesn't connect. This flash security policy stuff is kicking my butt all over the place. :confused:
This is what I have...
-Tomcat running on port 80, serving the swf file
-a java socket server running on port 8080 that keeps all the connections and broadcasts messages as needed (for a new person entering / leaving the channel)
So I think I understand that since the swf is on port 80 from my IP that it needs a cross domain policy to be able to access the socket on port 8080. I know theres a socket or http based request methods, I would prefer to do it via http.
I put the file "crossdomain.xml" file in my root directory of the webserver, so that http://xx.xx.xx.xx/crossdomain.xml will actually display in the broswer.
I've put the load policy file directly before the socket creation / connection...ex:
Security.loadPolicyFile("http://xx.xx.xx.xx/crossdomain.xml");
mySocket = new Socket();
I type the url pointing to the html file flex created:
http://xx.xx.xx.xx/test.html
into IE to display the swf. Like I said...everything works perfectly opening multiple client connections on my computer. Anything off my computer (lan or internet) will not work though...everything comes back with a security error. (Error #2044: Unhandled SecurityErrorEvent:. text=Error #2048: Security sandbox violation).
Just in plain frustration I tried calling Security.allowDomain("*") which I dont think I need...but that too failed.
Any suggestions on how to get this http request policy working would be greatly appreciated...I guess in the mean time since I'm somewhat at a deadend I'll try the socket based policy request...but I would like to know what exactly I did wrong for the http one. Thanks.