What's New in Director 8.5 > Using the Shockwave Multiuser Server and Xtra > Optimizing multiuser movies > Using setNetMessageHandler()

 

Using setNetMessageHandler()

By assigning different subjects to the different types of messages you are sending, you can use setNetMessageHandler() to process incoming messages depending on the subject, the sender, or both. The Xtra's message-dispatching routines are faster than similar code written in Lingo.

To change which message callback handler is triggered by a certain type of message, use setNetMessageHandler() to remove the reference to the first handler by using a zero in place of the handler symbol:

errCode = gMultiuserInstance.setNetMessageHandler(0, script "Connection Script", "Chat Text", "Guest Speaker", 1)

You can then declare a new handler for the same message criteria by calling setNetMessageHandler() again and specifying the new handler symbol:

errCode = gMultiuserInstance.setNetMessageHandler(#newMessageHandler, script "Connection Script", "Chat Text", "Guest Speaker", 1)