insert script

Hershel Fisch hershrev at
Mon Sep 6 20:59:18 EDT 2004

On Monday, September 6, 2004, at 08:06 PM, Ken Ray wrote:

> On 9/6/04 5:16 PM, "Hershel Fisch" <hershrev at> wrote:
>> Hi all ,
>> I'm trying to figure out how the insert script works.
>> I have a "script Lib." stack containing only custom handlers and
>> functions
>> I have a sub stack "myStack" in an openStack message I  put in "insert
>> script from stack "script Lib" into back"
>> Now when I open the sub stack "mySTack" the on openStack message
>> triggers the handler from the script lib. even its into back and I 
>> have
>> an on openStack in the main stack.  Also when open another sub stack
>> with no insert script in it , it triggers that same script as said
>> above , wondering , what is the proper understanding of the "insert
>> script" .
> The use of "insert script" is much like the use of libraries - you 
> place an
> entire script in the message passing hierarchy, but *after* the 
> "normal"
> stacks receive the message. This allows you to trap messages that other
> object have not trapped (if you insert into the back - a 
> "backScript"), or
> to trap messages before they hit their intended target (if you insert 
> into
> the front - a "frontScript"). This applies to all open stacks and 
> substacks
> - backscripts are "behind" every stack, and frontScripts are "in front 
> of"
> every stack.
What I understand (and what I see)  is that if sub stack "A", handler 
"a" has an insert script "tScript" into "back or front"
then sub stack "B" will react the same way even if sub stack "B" 
doesn't have the insert. Is this the way it suppose to work ?
Thanks, Hershel
> The reason you're getting what you're getting is that when a stack 
> opens, a
> number of messages are triggered (openCard, preOpenCard, openStack,
> preOpenStack, etc.), and so if the stack that opens doesn't trap all of
> these (and most don't), they will make their way "up" (it's how I 
> visualize
> it) the message passing hierarchy and eventually hit the backscript 
> which
> will get it and activate it. In your case, it's the openStack message.
> Personally, I would put the common handlers and functions into another
> object and insert *its* script into the back. I commonly do this with a
> button called "BS" (for backscript) or "FS" (for frontscript) as in:
>   insert the script of btn "BS" into back
> HTH,
> Ken Ray
> Sons of Thunder Software
> Web site:
> Email: kray at
> _______________________________________________
> use-revolution mailing list
> use-revolution at

More information about the use-livecode mailing list