Chapter 14
366
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
property
statement that allows each instance to maintain a separate value for the property
•
An
on getPropertyDescriptionList
handler that sets up the property
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
statement at the beginning of the behavior’s script.
A
property
statement starts with the word
property
followed by the names of the individual
properties. For example, the statement
property movement
declares that
movement
is a property
of the behavior.
Customizing a behavior’s property
If a behavior’s script includes an
on getPropertyDescriptionList
handler, Director lets users
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
handler generates a property list that specifies these
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.
Summary of Contents for DIRECTOR MX-USING DIRECTOR MX
Page 1: ...Using Director MX Macromedia Director MX...
Page 12: ...Contents 12...
Page 156: ...Chapter 4 156...
Page 202: ...Chapter 6 202...
Page 244: ...Chapter 7 244...
Page 292: ...Chapter 10 292...
Page 330: ...Chapter 12 330...
Page 356: ...Chapter 13 356...
Page 372: ...Chapter 14 372...
Page 442: ...Chapter 16 442...
Page 472: ...Chapter 18 472...
Page 520: ...Chapter 19 520...
Page 536: ...Chapter 20 536...
Page 562: ...Chapter 23 562...
Page 566: ...Chapter 24 566...
Page 602: ...Chapter 27 602...