To allow users to set different values for a property in different instances of the behavior, the
behavior's script needs two types of Lingo:
•
A
statement that allows each instance to maintain a separate value for the property
property
•
An
on getPropertyDescriptionList
Setting behavior properties with Lingo
Behaviors usually have properties for which each instance of the behavior maintains its own
values. (An instance is each sprite or frame that the behavior is attached to.) These properties are
shared among handlers in a behavior's script the same way that properties are shared among
handlers in an object.
To declare which properties can have independent values in each instance of the behavior:
•
Put the
property
A
statement starts with the word
property
properties. For example, the statement
of the behavior.
Customizing a behavior's property
If a behavior's script includes an
set the property's initial values from the Parameters dialog box. The behavior's Parameters dialog
box opens in three circumstances:
•
After the user drags a behavior to a sprite or frame
•
When the user double-clicks the behavior in the Behavior inspector dialog box
•
When the user clicks the Parameters button in the Behavior inspector
The
on getPropertyDescriptionList
attributes of the property:
•
The default initial value
•
The type of data the property contains, such as Boolean, integer, string, cast member, or a
specific type of cast member
•
A comment in the Parameters dialog box to describe what the user is setting
The definition of a behavior's property must include the property's name, default value, and data
type and the descriptive string that appears in the Parameters dialog box. The definition can also
include an optional specification for the range of values allowed for the property.
The name of the property comes first in the definition. The remainder of the definition is a
property list that assigns a value to each of the property's attributes.
366
Chapter 14
handler that sets up the property
statement at the beginning of the behavior's script.
property
property movement
on getPropertyDescriptionList
handler generates a property list that specifies these
followed by the names of the individual
declares that
movement
handler, Director lets users
is a property
Need help?
Do you have a question about the DIRECTOR MX-USING DIRECTOR MX and is the answer not in the manual?