Kongregate Developers

Events

You may use the standard addEventListener function to listen for various events broadcast by the chat API.

The tab_visible event is broadcast when a showTab request is completed and the custom tab is created:

kongregate.chat.addEventListener("tab_visible",onTabShown);
function onTabShown(event:Event){
  trace("Tab shown!");
}

The message event is broadcast when the player inputs something into the chat window and presses return. The event contains a data field which you can use to get at the text that was entered:

kongregate.chat.addEventListener("message",onPlayerMessage);
function onPlayerMessage(event:*){
  trace("Message: " + event.data.text);
}

Comments