I have a java server (that now runs locally) to开发者_开发百科 which my flash app will connect. Although it connects just fine when i run from CS4, when i exported the app and use XAMPP to access the flash app from the browser i get an error:
{NetworkManager}: (Security Error) [SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048"]
what can i do to establish the connection either i run the app from CS4 or by accessing the published on from a browser?
If you're talking about an HTTP connection on port 80 then you need to the target serve to provide a cross-domain policy file.
http://www.adobe.com/devnet/flashplayer/articles/cross_domain_policy.html
When an attempt is made to load content into a SWF file at runtime, the request is subject to the Flash Player security model, which is in place to protect users and website owners. As part of this model, Flash Player by default prevents cross-domain loading of data, but allows cross-domain sending of data.
<!-- crossdomain.xml in root -->
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
If you're talking about a socket connection on another port, then to setup a socket policy server to provide a policy file on a specific port. It needs to listen for connections on port 843 and then serve up a policy file which specifies which domains are allowed access to which local ports.
<cross-domain-policy>
<allow-access-from domain="swf.example.com" to-ports="123,456-458" />
</cross-domain-policy>
There are free options for hosting a separate process to serve this file or you can implement it yourself within your current Java application.
http://www.adobeopenoptions.com/devnet/flashplayer/articles/socket_policy_files.html
精彩评论