User Guide

574
script
Syntax
the script of menuItem whichItem of menu whichMenu
childObject.script
the script of childObject
Description
Menu item and child object property.
For menu items, determines which Lingo statement is executed when the specified menu item is
selected. The
whichItem expression can be either a menu item name or a menu item number; the
whichMenu expression can be either a menu name or a menu number.
When a menu is installed, the script is set to the text following the “Å” character in the menu
definition.
This property can be tested and set.
Note: Menus are not available in Shockwave.
For child objects, the return value is the name of the child’s parent script. This property can be
tested but not set.
To see an example of
script used in a completed movie, see the Parent Scripts movie in the
Learning/Lingo Examples folder inside the Director application folder.
Examples
This statement makes goHandler the handler that is executed when the user chooses the Go
command from the custom menu Control:
set the script of menuItem "Go" of menu "Control" to "goHandler"
This Lingo checks whether a child object is an instance of the parent script Warrior Ant:
if bugObject.script = script("Warrior Ant") then
bugObject.attack()
end if
See also
checkMark, installMenu, menu, handlers(), scriptText
scriptInstanceList
Syntax
sprite(whichSprite).scriptInstanceList
the scriptInstanceList of sprite whichSprite
Description
Sprite property; creates a list of script references attached to a sprite. This property is available
only during run time. The list is empty when the movie is not running. Modifications to the list
are not saved in the Score. This property is useful for the following tasks:
Attaching a behavior to a sprite for use during run time
Determining if behaviors are attached to a sprite; determining what the behaviors are
Finding a behavior script reference to use with the sendSprite command