Expand my Community achievements bar.

Easy alert for private chat

Avatar

Former Community Member

I am having too much fun wiring up a simple private chat program with afcs.  I now have a custom roster that shows what users are online or not,  and a simple mouse click starts a SimpleChat with the user.  The only problem is that I need to send an alert to the person I am chatting with so that they know to open their chat window and start banging out a reply.  Looking for any simple solutions such as sending an annoying buzzer / displaying an annoying popup, etc.  You know the kind.   Thanks

1 Reply

Avatar

Employee

One of the approaches are, You can make all the users subscribe to the SimpleChatModel and listen to the ChatEvent.HISTORY_CHANGE event. And in your event listener you could add your UI code to invoke the chat window at the receivers end.

Protected function init():void

{

                _model = new SimpleChatModel();

                _model.connectSession = _connectSession ;

                _model.subscribe();

                _model.addEventListener(CollectionNodeEvent.SYNCHRONIZATIONCHANGE, onSynchronizationChange);

                _model.addEventListener(ChatEvent.HISTORYCHANGE, onHistoryChange);

}

protected function onHistoryChange(p_evt:ChatEvent):void {

    //Invoke UI

}