Lingo Dictionary > O-R > property |
![]() ![]() ![]() |
property
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
Example
This parent script handler declares pMySpriteNum
a property to make it available:
-- script Elder property pMyChannel on new me, whichSprite me.pMyChannel = whichSprite return me end
The original behavior script sets up the ancestor and passes the spriteNum
property to all behaviors:
property spriteNum property ancestor on beginSprite me set ancestor = new(script "Elder", spriteNum) end
See also
![]() ![]() ![]() |