Simple Scoping Question

Scott Rossi scott at tactilemedia.com
Wed Apr 20 14:51:17 EDT 2005


Recently, David Burgun  wrote:

>> If your openStack handler is only supposed to apply to your main stack, then
>> place the openStack handler in the script of the *first card* of your main
>> stack (this goes for any initialization handlers since they are only called
>> when the first card is opened).  Any subsequent opening/closing of stacks
>> will not trigger the init handler/s.

> Thanks a lot for this. No, I don't have any substacks so moving it
> into the card script sounds best. Ok a couple of questions of this.
> You say move it to the "first card", well in this stack there is only
> one card so the issue doesn't come out, but for the sake of knowing,
> if I have more than one card in the stack, do you mean the card that
> is currently the "first" card, or the first card created by the IDE?

Literally, the first card of *your* main stack.

In your case there is only one card but the method still applies: whenever
you need to initialize stuff, placing the init scripts in the first card of
your main stack limits causes the scripts to run only when the main stack is
opened (preOpenStack, openStack, openCard, etc).  Subsequent opening/closing
of substacks or IDE stacks will not trigger your card scripts because they
are not part of the other stacks' message hierarchy.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the use-livecode mailing list