User Guide

Customizing a behavior’s property 283
Customizing a behavior’s property
If a behaviors script includes an on getPropertyDescriptionList handler, Director lets users
set the property’s initial values from the Parameters dialog box. The behaviors 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 handler generates a property list that specifies these
attributes of the property or variable:
The default initial value
The type of data the property or variable 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 behaviors property or variable must include the propertys or variables 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 or variable.
The name of the property or variable comes first in the definition. The remainder of the
definition is a property list that assigns a value to each of the propertys or variables attributes.
For example, to define the property
movement as an integer that can be set to a value from 1 to 10
and whose default value is 5, use a phrase similar to this:
#movement: [#default: 5, #format:#integer,
#comment: "Set motion to the right:", #range: [#min:1, #max:10]]
#movement is the property’s name. A symbol (#) operator must precede the name in the
property definition. A colon separates the names definition and the list of parameters.
#default specifies the property’s default value. This example sets 5 as the default.
#format specifies the propertys type. This example sets the type as an integer. Some other
possible types are Boolean, string, cast member, event, and sound. For more information, see
the Scripting Reference topics in the Director Help Panel.
#comment specifies a string that appears next to the parameter in the Parameters dialog box.
This example makes “Set motion to the right” the comment that appears in the Parameters
dialog box.