forked from: union 接続テスト
recompiled to use reactor Alpha6 !
/**
* Copyright mash ( http://wonderfl.net/user/mash )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/gMTm
*/
// recompiled to use reactor Alpha6 !
// forked from keno42's union 接続テスト
package {
import net.user1.reactor.*;
import flash.display.Sprite;
import flash.text.*;
public class FlashTest extends Sprite {
private var tf:TextField = new TextField();
private var server:String = "tryunion.com";
private var port:int = 9100;
private var reactor:Reactor = new Reactor();
public function FlashTest() {
// write as3 code here..
reactor.addEventListener(ReactorEvent.READY, onReady);
reactor.addEventListener(ReactorEvent.PROTOCOL_INCOMPATIBLE, onProtocolIncompatible);
reactor.addEventListener(ReactorEvent.CLOSE, onClose);
reactor.connect(server,port);
addChild(tf);
tf.autoSize = "left";
tf.appendText(server+":"+port+" に接続中です...\n");
}
private function onReady(e:ReactorEvent):void{
tf.appendText("接続完了しました\n");
}
private function onClose(e:ReactorEvent):void{
tf.appendText("切断されました\n");
}
private function onProtocolIncompatible(e:ReactorEvent):void{
tf.appendText("プロトコルが不適合です(サーバーUPCバージョン:"+e.getServerUPCVersion()+", クライアントUPCバージョン:"+reactor.getSystem().getUPCVersion()+")\n");
}
}
}