Sent to the destination card right after you open a stack.




on openStack
  send "rollCredits" to field "Credits"
end openStack

Handle the openStack message to change a stack's objects, or perform other updates, when the stack is opened.

The OpenStack message is sent to the current card, but if it isn't the card, it's sent to the stack. So if you put the Openstack both in stack and in card, only the one in the card will be executed.

The openStack message is sent after the stack is visible.

To make changes that take effect before the stack becomes visible on the screen, use a preOpenStack handler instead of openStack.

If you put the OpenStack message in the mainstack, all substacks will activate it, so this could can prevent to activate the handler in substacks:

on OpenStack
 if the owner of the target is me then
    -- code runs for this stack only
    answer "Opened mainstack"
    -- code runs for any stack that's opened other than this one
    answer "Opened a Substack"
 end if
end OpenStack

The actual opening is not triggered by the openStack message, so trapping the message and not allowing it to pass does not prevent the stack from opening.

See also: openBackground (message), resume (message), stack (object),