Anyone know how to use an XMLSocket in flash (using actionscript)
I've been trying for days to get XMLSocket.connect to work. And it just
won't. It always returns false. The code I'm using is:
var net:XMLSocket = new XMLScoket();
net.onConnect = function(success:Boolean){
if(!success){
XMLResult.text = "connection failed on onconnect";
}
else{
XMLResult.text = "succeeded!";
}
}
var b:Boolean = net.connect("localhost",4482);
if(!b){
XMLResult.text = "----failed to connect";
}
else{
XMLResult.text = "---connected";
}
b is *always* false, no matter what I try. I put the swf file on the
hard drive, I've had it downloaded from localhost over HTTP, I put up a
polcy file, My windows firewall is turned off. I've tried everything,
and it won't even get to the 'onConnect' part! WTF is going on?
The crazy thing is, if I call the following code
System.security.loadPolicyFile("xmlsocket://localhost:4482");
The Flash player makes a network connection, sends the correct XML, and
downloads the result just fine! But when I call XMLsocket.connect() it
just returns false and won't even try to connect to my server!
The flash movie has no problem doing an XML.load() from the same server
(using the HTTP protocol).
This is driving me crazy. I've been going over the security and policy
stuff like crazy, and I still have no idea what's going on. It's driving me totaly nuts.
(I hate flash)
crossdomain.xmlfile in the root path of the server hosting the downloaded XML? The file should contain the following data for testing purposes:I know relatively little about Flash itself, but my company makes extensive use of it, and the lack of a
crossdomain.xmlis one of the most common causes for Flash security issues. That, and missingallowDomain()calls in externally-loaded SWFs.posted by Danelope at 9:14 PM on September 16, 2005