2012-12-01 182 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); 
      } 
     } 
    }