• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Lesson 21. Controlling Sprites with Ling... > Creating Custom Messages and Handler...

Creating Custom Messages and Handlers

The mouseDown handlers for both the Up and Down buttons are getting very large and cumbersome. You can both reduce the size of these handlers and make them easier to read by instead creating three handlers: one handler to move the arm up, a second to move the arm down, and a third to display the normal and highlighted states of the button. Placing pieces of functionality in separate handlers makes your Lingo scripts modular and therefore easier to maintain.

Just as Director sends messages in response to events in a movie, you can create custom messages to trigger handlers that you write. As you know from previous lessons, when Director sends a mouseDown message, the message travels through the scripts in the movie, looking for a mouseDown handler to execute. In the same way, you can send a custom MoveArmUp( ) message:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint