Re: Scope of globals, parents and children, "load script" and all that jazz
Re: Scope of globals, parents and children, "load script" and all that jazz
- Subject: Re: Scope of globals, parents and children, "load script" and all that jazz
- From: "Patrick S. Page-McCaw" <email@hidden>
- Date: Thu, 17 May 2001 13:08:52 -0700
I had some troubles with scipt objects and load script a while back, got
things to work, but am still often confused. So I set about to see how
Arthur J. Knapp's experiment worked and immediately ran into a problem.
In ScriptEditor I get the same behavior that Arthur sees, but in Smile I
get different behavior (see Arthur's post for the scripts, "hello world"
abbreviated to "HW"):
ScriptEditor Smile
------------ ------
run of LoadedChild { "HW", 0, "HW"} {"HW", "HW", "HW"}
run of LocalChild {"HW", "HW", "HW"} {"HW", "HW", "HW"}
UseIt() of LoadedChild error error
UseIt() of LocalChild "HW" "HW"
UseMy() of LoadedChild error "HW"
UseMy() of LocalChild "HW" "HW"
UseGlobal() of LoadedChild "HW" "HW"
UseGlobal() of LocalChild "HW" "HW"
All examples were run from within ScriptEditor or Smile and not as saved
applets. I'm just guessing here, but it seems to me that in Smile "my"
refers to the script while in ScriptEditor "my" refers to ScriptEditor?
So then if I save the MainScript as an applet with the last line:
display dialog (UseMy() of LoadedChild)
I get the dialog "Hello World". So it seems here that Smile better
emulates the behavior of applets, from within the editor, than does
ScriptEditor. (Please, I dont want to start the editor wars again.) And
suggests that we need to be careful in designing objects (well I do since I
really have no clue what I'm doing) and predicting the behavior of the
applet from the behavior in the Editor.
Patrick S. Page-McCaw