My attempt at an explanation has obviously failed :-) so I suggest you search the Transcript dictionary for "global". From the "See also" menu, read the article titled "About containers, variables and sources of value".

Basically: if you declare your variable in the stack script, outside any handler, then all the handlers in the stack script can use it. If you need to use it in another object's script, you need to declare it again in that script, either inside or outside the handlers.

Just one more thing: "global mygabc = 3" will not work. You have to initialize your global inside a handler using the form "put 3 into mygabc".

Cheers,
Sarah

On 5 Feb 2004, at 10:53 am, hershrev wrote:


On Wednesday, February 4, 2004, at 07:27 PM, Sarah Reichelt wrote:


A global works everywhere, but it has to be declared in each place where you need to use it. i.e. you must include the line "global gMyGlobalVar" in every script that needs access to the global gMyGlobalVar. If you declare it in a handler, only that handler sees it, but if you declare it outside the handler, all the handlers in that script can see it without needing a separate declaration in each handler. Even though globals are accessible everywhere, you must tell each script or handler that they are globals before you use them, otherwise they will just assume you are creating a local variable of the same name.
That means if I declare a "global mygabc =3' out side of a scrip in a stack ,when I need it in a button I have to declare it again
"global mygabc" in the button script.
and if I declare it in a handler in a stack ????? Where is the difference ??
Thanks

_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to