Thank you for visiting Blazing Games

Adding call-backs to dialog

The map handling and inventory handling are pretty much the same as was discussed in earlier chapters so there is probably no need to cover those topics. So today’s big feature will be looking at the conversation system. There are two distinct conversations. While I could have easily had a single function handle both conversations, I decided that it would be more useful as well as easier to debug if the dialog bubble was able to call a specified function. This would allow for multiple handler functions with each handler able to handle specific cases. While most episodes could get by with a single handler, having multiple handlers is a nice feature and adds a lot of flexibility.

The way to handle multiple listener functions is to simply take advantage of the dynamic function calling methods that Flash provides. I have added this functionality by simply having a function that lets the callback function be specified by a simple setCallback function call. The actual handling of the dynamic callback function call is handled by the callCallback function. The three menu#selected functions also had to be changed slightly to support this feature. The changed code is below for your reading pleasure.


Previous page
Chapter 5 Page 5

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2006 Blazing Games Inc. All Rights Reserved