如何使用Flex在java中开发一对一聊天?

如何使用Flex在java中开发一对一聊天?,java,apache-flex,Java,Apache Flex,在我正在编写的Flex应用程序MXML文件中 <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="598" height="459" creationComplete="consumer.subscribe()" layout="vertical"> <mx:Script

在我正在编写的Flex应用程序
MXML
文件中

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                width="598" height="459" creationComplete="consumer.subscribe()" layout="vertical">

    <mx:Script>
        <![CDATA[
        import mx.controls.Alert;
        import mx.messaging.messages.AsyncMessage;
        import mx.messaging.messages.IMessage;

        public function send():void {
        var message:IMessage = new AsyncMessage();
        message.destination = "SimpleChatDestination";
        message.body = "\n" + usernameInput.text + ":\t" + messageInput.text;

        trace(producer.connected);
        producer.send(message);

        messageInput.text = "";
        }

        public function messageHandler( message:IMessage ):void {
        textArea.text += message.body;
        }
        ]]>
    </mx:Script>

    <mx:Producer id="producer" destination="SimpleChatDestination"/>

    <mx:Consumer id="consumer" destination="SimpleChatDestination" message="messageHandler(event.message)"/>

    <mx:TextArea id="textArea" width="400" height="300" color="#F31C1C" editable="false"
                 enabled="false"/>

    <mx:HBox horizontalGap="0">
        <mx:TextInput id="usernameInput" width="80"/>
        <mx:TextInput id="messageInput" width="180"/>
        <mx:Button label="Send" click="send();"/>
    </mx:HBox>

</mx:Application>

请帮助我..

我想您可以使用该属性来标识唯一的发送方/接收方对。他们是否有这样的示例。。
<?xml version="1.0" encoding="UTF-8"?>
<service id="message-service" 
    class="flex.messaging.services.MessageService">

    <adapters>
        <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="true" />
        <!-- <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/> -->
    </adapters>

    <default-channels>
        <channel ref="my-polling-amf"/>
    </default-channels>

        <adapters>
        <adapter-definition id="actionscript" default="true" />
        <!-- <adapter-definition id="jms"/> -->
    </adapters>

    <default-channels>
        <channel ref="my-polling-amf"/>
    </default-channels>

 <destination id="SimpleChatDestination">
  <properties>
   <network>
    <subscription-timeout-minutes>0</subscription-timeout-minutes>
   </network>
   <server>
    <message-time-to-live>0</message-time-to-live>
    <allow-subtopics>true</allow-subtopics>
    <subtopic-separator>.</subtopic-separator>
   </server>
  </properties>

 </destination>

</service>
    i want only allow two user can only chat if 3rd user came not visiable 2nd person chating information.
just it is like Facebook,Gmail chating.