Writing Behaviors With Lingo; Setting Up A Parameters Dialog Box - MACROMEDIA DIRECTOR MX-USING DIRECTOR MX Use Manual

Table of Contents

Advertisement

executes any Lingo function or sends a message to a handler. You specify the new
New Action
handler's name.

Writing behaviors with Lingo

If you are familiar with Lingo, you can author your own behaviors.
From the perspective of Lingo, a behavior is a script with these additional features:
Each instance of the behavior has independent values for properties. Lingo uses a
statement to declare properties that can have independent values in each instance of the
behavior. See
property
The same set of handlers can be shared by multiple sprites or frames.
The handlers in a behavior are basically the same as other handlers. Include as many handlers
as appropriate to implement the behavior.
A behavior is usually attached to multiple sprites or frames. As a result, the sprites and frames
share the same handlers. Director tracks which instance of the behavior is which by assigning
each instance a reference number. The variable
instance of the behavior is attached to.
In many cases it's most efficient to create behaviors dedicated to specific tasks and then attach a
set of behaviors that perform the variety of actions you want.
The behavior can have parameters that users edit from the Parameters dialog box. The optional
on getPropertyDescriptionList
getPropertyDescriptionList
A description of the behavior can be added to the Behavior inspector. The optional
getBehaviorDescription
inspector. See
A brief description appears as a tooltip for the behavior in the Library palette if the optional
getBehaviorToolTip
on getBehaviorTooltip

Setting up a Parameters dialog box

It's impossible to predict exactly what a user will want behaviors to do. You can make behaviors
more flexible by letting the user customize the behavior's parameters.
For example, this handler moves the sprite 5 pixels to the right each time the playhead enters a
new frame:
on enterFrame me
if the locH of sprite the spriteNum of me > the stageRight then
set the locH of sprite the spriteNum of me = the stageLeft
else
set the locH of sprite the spriteNum of me to ¬
(the locH of sprite the spriteNum of me + 5)
end if
end
However, users could adjust the speed of each sprite if they could specify how far individual
sprites move to the right in each frame.
in the Lingo Dictionary.
in the Lingo Dictionary.
handler displays a description of the behavior in the Behavior
on getBehaviorDescription
handler that creates the tooltip has been written. See
in the Lingo Dictionary.
contains the reference for the object that the
me
handler sets up the Parameters dialog box. See
in the Lingo Dictionary.
property
on
on
on
Behaviors 365

Advertisement

Table of Contents
loading

This manual is also suitable for:

Director mx

Table of Contents