2012-12-01 133 views
2

我正在使用Flash Media Development Server 4.5创建一个小型聊天应用程序。我已经在Flash中创建了所有的用户界面组件。Adob​​e Flash Media Server聊天

要有一个聊天应用程序,用户需要互相发送消息。 Flash播放器如何连接到其他Flash播放器?例如,如果您有一组20个成员,例如。你如何向客户发送特定的消息而不是组?

回答

0

聊天应用程序的示例是www.red5chat.com。免费使用。并检查代码闪存和Java。发送悄悄话给服务器端的客户端代码是

public void send_private(String fromPseudo, String DestinationID,String msg) { 
     //IConnection current = Red5.getConnectionLocal(); 
     Iterator<IConnection> it = scope.getConnections(); 
     log.debug("send_private to "+DestinationID+" "+msg); 
     //String uid = scope.getClient().getId(); 
     while (it.hasNext()) { 
     IConnection conn = it.next(); 
     String id=conn.getClient().getId(); 
     log.debug("id="+id+ " senTO="+DestinationID); 
     //if (sendTo.equals(id)) log.info("PAREIL"); else log.info("differents"); 

     if (!(DestinationID.equals(id))) continue; 
     log.info("receive_private "+DestinationID+" "+msg); 
      if (conn instanceof IServiceCapableConnection) { 
       ((IServiceCapableConnection) conn).invoke("receivePrivateMsg", new Object[]{fromPseudo, msg}); 
       log.info("received_private "+DestinationID+" "+msg); 
      } 
     } 
    }