More Scope Problems

Rob Cozens rcozens at pon.net
Tue Jan 3 11:34:43 EST 2006


Morning Dave,

>I have number of stacks:
>
>StackA
>StackB
>StackC
>
>In the preOpenStack hander of Card 1 of StackA, I load some other 
>stacks using the:
>
>go invisible stack "StackB"
>close stack "StackB"
>
>(The above it just to get the stack loaded and to setup some values 
>that are needed by StackA)
>
>Then I do the following:
>
>send "StackInitialize" to this stack
>
>Which should (unless I am wrong) call the "StackInitialize" handler 
>in StackA.

I cannot tell you positively what is going wrong; but offer the 
following comments and suggestions:

* Unless the destroyStack property of Stack B is true, it is still in 
RAM after you close it.  Apparently it is (at least sometimes) still 
in the message path despite being closed.

* You _might_ solve the problem by adding to the StackInitialize handlers:

         if the name of the target is not the name of me then pass 
StackInitialize

* You can initialize variables and such from Stack B without opening it:

Instead of 'go invisible stack "Stack B"', try 'start using stack 
"Stack B"'.  In Stack B's stack script add--

         on libraryStack
                 -- initialization
         end libraryStack

* You can get & set values for Stack B without going to it:

         get field x of card y of stack "Stack B"
         set the icon of button q of card r of stack "Stack B" to myIcon

Rob Cozens CCW
Serendipity Software Company

"And I, which was two fooles, do so grow three;
  Who are a little wise, the best fooles bee."

  from "The Triple Foole" by John Donne (1572-1631) 




More information about the use-livecode mailing list