Calling Functions in Other Objects
Mac OS 9 Mac OS X Windows Linux

>hello: i have a project with several stacks. if i am in stack A and
>want to call a function that is in the stack script of stack B, how
>do i do it?

Besides the suggestion of "start using" (or "insert script", which is similar), you can use the value function to specify the object whose script contains the function you want to use. For example, if the script of stack "My Stack" contains a function called "myFunction", you can use the value function like this in any script:
put value("myFunction()", stack "My Stack) into myValue
Generally, the value function is more appropriate if you have a "one-shot" need to call a function that's in an object not in the message path; "insert script" and "start using" are more appropriate if you need to call functions from time to time throughout your app.

Posted 12/1/2002 by Jeanne A. E. DeVoto to the Use-Revolution List    (See the complete thread)


Here is a trick that works with simple constant parameters:
call "return bumpIt(17)" of button "Test"
put the result into field "Report"
Also, if you have control over the script of the object, use a handler and use return in the handler. To use it use send (not in time) and get the result with result(). This is much better in that it is not limited to constant parameters.

Posted 12/1/2002 by Dar Scott to the Use-Revolution List    (See the complete thread)