XMLSocket使って、Flashでechoサーバのクライアントを作ろうとしたら、onConnectでなぜか失敗…(connectは成功してるのに)
echoサーバには「
import flash.external.ExternalInterface; class EchoClient { static function main() { var sock = new XMLSocket(); var log = function(msg) { ExternalInterface.call('window.alert', msg); } sock.onConnect = function (success) { log('onConnect(): ' + success); } sock.onData = function (src) { log('onData(): ' + src); ExternalInterface.call('js_func', src); sock.close(); } ExternalInterface.addCallback('fs_func', null, function(msg) { if (sock.connect(null, 7)) { log('connect(): true'); } else { log('connect(): false'); } }); }; }