Behaviors
367
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 name’s definition and the list of parameters.
•
#default
specifies the property’s default value. This example sets 5 as the default.
•
#format
specifies the property’s type. This example sets the type as an integer. Some other
possible types are Boolean, string, cast member, event, and sound. For a complete list of
possible values for
#format
, see
on getPropertyDescriptionList
in the Lingo Dictionary.
•
#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.
•
#range
specifies a range of possible values that the user can assign to the property. Specify the
possible values as a list.
To specify a range between a minimum and maximum number, use the form [
#min:minimum,
#max:maximum
]
.
The example sets the range from 1 to 10. When the range is between a
maximum or minimum number, the Parameters dialog box provides a slider that sets the value.
To specify no range, omit the
#range
parameter. If the property’s definition doesn’t include
#range
, a text entry field appears for the user to enter a value in the Parameters dialog box.
To specify a set of possible choices, use a linear list. For example, the list
[#mouseUp,
#mouseDown, #keyUp, #keyDown]
makes these four events possible choices for a parameter.
When you specify values in a linear list, the choices appear in a pop-up menu in the
Parameters dialog box. (For this example list, you need to specify
#format: #symbol
for
the list to display correctly.)
As another example, this statement defines the property
whichSound
:
addProp description, #whichSound, [#default: "", #format:#sound, #comment: ¬
"Which cast member"]
The value
#sound
assigned to
#format
provides a pop-up menu in the Parameters dialog box that
includes every sound cast member available in the movie.
If the behavior includes a command that plays a sound, this property can be used to specify a
sound cast member to play. For example, if the user selects Growl from the pop-up menu in the
Parameters dialog box, the statement
puppetSound whichSound
would play the sound cast
member Growl.
Creating an on getPropertyDescriptionList handler
To build a list of properties for a behavior, add each property to the list that the
on getPropertyDescriptionList
handler returns. Then use the
return
command to
return the list.
Содержание DIRECTOR MX-USING DIRECTOR MX
Страница 1: ...Using Director MX Macromedia Director MX...
Страница 12: ...Contents 12...
Страница 156: ...Chapter 4 156...
Страница 202: ...Chapter 6 202...
Страница 244: ...Chapter 7 244...
Страница 292: ...Chapter 10 292...
Страница 330: ...Chapter 12 330...
Страница 356: ...Chapter 13 356...
Страница 372: ...Chapter 14 372...
Страница 442: ...Chapter 16 442...
Страница 472: ...Chapter 18 472...
Страница 520: ...Chapter 19 520...
Страница 536: ...Chapter 20 536...
Страница 562: ...Chapter 23 562...
Страница 566: ...Chapter 24 566...
Страница 602: ...Chapter 27 602...