Flex网页游戏防止双开
因为现在游戏的登录控制是通过cookie来做的,这样就会导致同一个用户的状态在多个客户端不一致。为了防止这个问题就必须禁止用户双开,在加载程序上附上这段代码就可以了
var instanceConnection :LocalConnection = new LocalConnection( );
var isRun:Boolean = false;
try
{
instanceConnection.client=this;
instanceConnection.connect( "double_run" );
}
catch (e:Error)
{
isRun = true;
}
if (isRun)
{
trace("double run");
}
else
{
trace("ok");
}