Home » Help Extras » Helpful Tips » Using the dynamic path
You can use the dynamic path to your advantage. For example, say that you have a stack with four different backgrounds and that you need to print each one differently. You place a handler called myPrint in the stack script:
You could place a handler for printBkgnd in the stack script. But since you want the four backgrounds to print different information, you would have to check the number of each background before printing:
But you can use the dynamic path to avoid the if statement altogether. To make HyperCard invoke the dynamic path, you should remove the printBkgnd handler from the stack script. Then, in the myPrint handler, precede the printBkgnd statement with the command go next background:
Now printBkgnd will travel along the message passing order as usual (the static path) until it reaches HyperCard itself. HyperCard won’t recognize printBkgnd as a built-in message, but since the myPrint handler has gone to another card, HyperCard invokes the dynamic path. It sends printBkgnd again as a message to the current card and passes it through the message passing order from there (the dynamic path).
Now you can place one printBkgnd handler in the script of each of the four backgrounds:
Any return-separated list of built-in commands, user-defined handlers, or keywords that are part of a message or function handler.
« User levels and Protect Stack | Helpful Tips | Wait for arrow pointer before dragging »
Helpful Tips