It's only flakey until you see how it works, and then it all falls into place. What you're seeing here is the message hierarchy at work. Event messages are sent to the current card. If there is no handler there to catch it, the message travels through the hierarchy until it is either caught by a handler or is thrown away by the engine. Substacks pass messages to the main stack script, and yours is catching it.
You can do what Richard suggested -- put the handler in the first card of the mainstack, which isn't in the hierarchy when messages pass from substacks. Or you can do what you did -- put a blank handler in as a trap to stop the message. You don't need any content, just the message name itself will do, like this:
Or third, you can put a test at the top of your openstack handler to see if the message applies to the mainstack or not:
Code: Select all
on openStack
if the target is not me then pass openStack -- (or exit openstack)
...
end openStack
All three of these methods will deal with messages that pass to your mainstack but shouldn't be handled. Richard's way is best for things like preOpenStack and openStack, because those messages are always sent to the first card of the mainstack when it opens.
There was a link somewhere here that pointed to info about the message hierarchy. You'll probably be frustrated until you know how it works.