上一篇說了一堆,想想還是把我的 code sample 放上來好了~
var playerVersion:String = System.capabilities.version;
var bkidx:Number = playerVersion.indexOf(" ");
var platform:String;
var majorVersion:String;
var minorVersion:String;
if (bkidx >= 0) {
platform = playerVersion.substring(0, bkidx);
var secondHalf:String = playerVersion.substring(bkidx+1,
playerVersion.length);
var vers:Array = secondHalf.split(",");
majorVersion = vers[0];
minorVersion = vers[2];
}var drcID:Number:
function doReadlConnect(server, port) {
clearInterval(drcID);
// do real stuff here
}function myConnect(server, port) {
System.security.loadPolicyFile("http://"+server+"/crossdomain.xml");
System.security.loadPolicyFile("xmlsocket://"+server+":"+port);var sock:XMLSocket = new XMLSocket();
sock.connect(server, port);
sock.onConnect = function() {
this.close();
delete this;
}var waitms = 1000;
if (majorVersion == "9" && minorVersion == "115")
waitms = 5000; // special for 9.0.115
drcID = setInterval(this, "doRealConnect", waitms, server, port);
}
注意,這只是節錄出來的 sample,不要照抄去用... XD
No comments:
Post a Comment