User Guide
property 217
Example
The following handler tests which key the user pressed most recently and responds accordingly:
• If the user pressed A, B, or C, the movie performs the corresponding action following the
of keyword.
• If the user pressed any other key, the movie executes the statement that follows the otherwise
keyword. In this case, the statement is a simple alert.
on keyDown
case (_key.key) of
"a": _movie.go("Apple")
"b", "c":
_movie.puppetTransition(99)
_movie.go("Oranges")
otherwise: _player.alert("That is not a valid key.")
end case
end keyDown
property
Usage
-- Lingo syntax
property {property1}{, property2} {,property3} {...}
Description
Keyword; declares the properties specified by property1, property2, and so on as
property variables.
Declare property variables at the beginning of the parent script or behavior script. You can access
them from outside the parent script or behavior script by using the
the operator.
Note: The spriteNum property is available to all behaviors and simply needs to be declared to be
accessed.
You can refer to a property within a parent script or behavior script without using the me
keyword. However, to refer to a property of a parent script’s ancestor, use the form
me.property.
For behaviors, properties defined in one behavior script are available to other behaviors attached
to the same sprite.
You can directly manipulate a child object’s property from outside the object’s parent scripts
through syntax similar to that for manipulating other properties. For example, this statement sets
the
motionStyle property of a child object:
set the motionStyle of myBouncingObject to #frenetic
Use the count function to determine the number of properties within the parent script of a child
object. Retrieve the name of these properties by using getPropAt. Add properties to an object by
using
setaProp().
To see an example of
property used in a completed movie, see the Parent Scripts movie in the
Learning/Lingo Examples folder inside the Director application folder.
Example
This statement lets each child object created from a single parent script have its own location and
velocity setting:
property location, velocity