2

In my Flex Application MXML file i'm writing..

<?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>

And in BlazeDs(java side) message-config.xml file i wrote code like this.

<?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>

So it is Working fine. But problem is when ever we open three are four chat boxes then all chat boxes are participated.

    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.

plz help me..

1
  • 2
    Are you the same person as "Narasimha Koppadi" who asked this question? stackoverflow.com/questions/12006739/… . This question is improved because you're providing code and some specific information. However, it still feels like you're asking us to write your business logic for you; as opposed to helping you solve a specific problem you encountered while writing your own business logic. Aug 18, 2012 at 14:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.