main.asc

来自「基于FLEX和FMS3的视频会议原代码,可实时观看别人的摄像头」· ASC 代码 · 共 42 行

ASC
42
字号
userList=[];

application.onAppStart=function()
{
	trace("fms服务器启动......");
}

application.onConnect = function(currentClient)
{
	application.acceptConnection(currentClient);
	if (userList.length>=3)
	{
		currentClient.call("showServerMsg",null,"已经达到最大用户数");
		application.rejectConnection(currentClient);
	}
	else
	{                 
		currentClient.communicateServer= function(value)
		{
			currentClient.username=value;
			trace(currentClient.username+"加入聊天室");
			userList.push(value);
			trace("当前用户列表"+userList);
			application.broadcastMsg("playOtherVideo",userList);
		}
	}
}

application.onDisconnect=function(currentClient)
{
	trace("用户"+currentClient.username+"离开聊天室");
	
	for(j=0;j<userList.length;j++)
	{
		if ( userList[j]==currentClient.username )
		{
			userList.splice(j,1);
		}
	}
	trace("当前用户列表"+userList);
	application.broadcastMsg("playOtherVideo",userList);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?