Using Director MX 2004 behaviors

Using Director MX 2004 behaviors
This article provides a basic introduction to Director MX 2004 behaviors. The article includes
the following sections:
About behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
New components in Director MX 2004. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Alphabetical list of included behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3D behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Accessibility behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Animation behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Controls behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Internet behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Media behaviors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Navigation behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Paintbox behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Text behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
About behaviors
Behaviors are prewritten Lingo scripts that provide interactivity and interesting effects for your
movie that would be difficult to create on your own. Some behaviors control the movement of a
sprite—for instance, a behavior might make a sprite follow the pointer or it might throw a sprite
across the Stage. Other behaviors provide control over properties of specific types of media, such
as the scale or quality of Flash content, the formatting of numbers, or the playback of a
QuickTime movie.
1
You access behaviors through the Behavior library by selecting Window > Library Palette. To view
the categories of behaviors that are available, click the Library List button. You can then select a
category from the pop-up menu to display a list of behaviors in that category.
Library List button
When you roll the pointer over a behavior icon, a short tooltip about how to use the behavior is
displayed.
2
Using Director MX 2004 behaviors
Next to the Library List button is the Library View Style button. By clicking this button you can
toggle between a graphical view of behaviors and a view that displays behaviors in a directory
structure.
Library View Style button
You add behaviors to movies by dragging them from the Library to the Cast, Stage, or Score. If
you use a behavior more than once, drag the behaviors to the Cast and then apply them
repeatedly to the Stage or Score. This keeps file sizes to a minimum.
When you add a behavior to a sprite or to the Score a dialog box appears that enables you to set
parameters for the behavior. You can change the parameters of a behavior at any time by selecting
the sprite on the Stage, opening the Property inspector (Window > Properties), and selecting the
Behaviors tab.
Note: You can add more than one behavior to a sprite.
About behaviors
3
After you add a behavior to your movie, you can see more information about it by clicking the
expander arrows in the Behavior inspector. (To view the Behavior inspector, click the Behaviors
tab in the Code panel, or select Window > Behavior Inspector.) Clicking the top arrow displays a
list of events in the behavior; clicking the bottom arrow displays a more detailed description
about how to use the behavior. You can resize the different sections of the Behavior inspector by
clicking and dragging the horizontal lines next to the expander arrows.
Expander arrow
In some cases, the script associated with a behavior contains notes that explain how to use the
behavior. To view the script, select the behavior in the Behavior window and then select
Window > Script.
For more detailed instructions on attaching behaviors and using the Behavior inspector, see
Director Help.
New components in Director MX 2004
Director MX 2004 now includes prebuilt Macromedia Flash MX 2004 components to help you
reduce your scripting time. While not technically behaviors, components are listed in the
Behavior library. You can drop components, such as calendars and user interface elements, into
movies to cut the time that it takes to develop interactive features.
The following components are included in Director MX 2004:
Button
component creates a button that can be customized to include an icon.
CheckBox
component lets you insert a graphic component that can represent an on or off state.
DateChooser
component lets you insert a graphic calendar of a month. The calendar shows the
current date and allows the user to navigate to any new day, month, or year.
4
Using Director MX 2004 behaviors
DVDController
component lets you add a prebuilt DVD playback control panel that includes
Play, Pause, Fast Forward, and Rewind buttons, a time counter, and volume control.
Label
List
component lets you insert a single-line, static text item (not editable).
component lets you insert a scrolling list that supports single or multiple selections.
NumericStepper
component inserts a graphic component that lets a user select a number from
an ordered set.
RadioButton component inserts a graphic radio button that represents a single choice within a
set of mutually exclusive choices.
ScrollPane
component lets you display a linked JPEG or SWF file in a scrollable area.
TextArea component is an editable, multiline text region. A TextArea component can be enabled
or disabled in an application. In the disabled state, it doesn’t receive mouse or keyboard input.
TextInput component
is an editable single-line text region. In the disabled state, it doesn’t receive
mouse or keyboard input.
Tree
component lets you create a graphical representation for organizing and manipulating
hierarchical data. The data of a tree component must be provided from an XML data source.
Note: There may be Flash components not described here that have been added to Director after
this document was created.
Alphabetical list of included behaviors
The following table lists all included behaviors alphabetically by behavior name. You can use this
table to look for a particular behavior based on the name of the behavior, or just to get an
overview of all available behaviors. Components new to Director MX 2004 are marked with an
asterisk (*).
Behavior
Category > Subcategory
Accessibility Captioning
Accessibility
Accessibility Group Order
Accessibility
Accessibility Item
Accessibility
Accessibility Keyboard Controller
Accessibility
Accessibility Speak
Accessibility
Accessibility Speak Enable Disable
Accessibility
Accessibility Speak Member Text
Accessibility
Accessibility Synch Caption
Accessibility
Accessibility Target
Accessibility
Accessibility Text Edit Item
Accessibility
Add Commas to Numbers
Text
Analog Clock
Controls
* New component in Director MX 2004
Alphabetical list of included behaviors
5
Behavior
Category > Subcategory
Automatic Model Rotation
3D > Actions
Avoid Mouse
Animation > Interactive behaviors
Avoid Sprite
Animation > Interactive behaviors
Barn Door
Animation > Sprite transitions behaviors
Button*
Components
Calendar
Text
Canvas
Paintbox
Channel Pan Slider
Media > Sound behaviors
Channel Volume Slider
Media > Sound behaviors
CheckBox*
Components
Click Model Go to Marker
3D > Actions
Color Cycling
Animation > Automatic behaviors
Color Selector
Paintbox
Constrain to LIne
Animation > Interactive behaviors
Constrain to Sprite
Animation >Interactive behaviors
Countdown Timer
Text
Create Box
3D > Actions
Create Particle System
3D > Actions
Create Sphere
3D > Actions
Custom Scroll Bar
Text
Cycle Graphics
Animation > Automatic behaviors
DateChooser*
Components
Display Text
Controls
Dolly Camera
3D > Actions
Drag and Toss
Animation > Interactive behaviors
Drag Camera
3D > Actions
Drag Model
3D > Actions
Drag Model to Rotate
3D > Actions
Drag Quad Points
Animation > Interactive behaviors
Drag to Rotate
Animation >Interactive behaviors
Drag to Scale
Animation > Interactive behaviors
Drag to Stretch and Flip
Animation > Interactive behaviors
* New component in Director MX 2004
6
Using Director MX 2004 behaviors
Behavior
Category > Subcategory
Draggable
Animation >Interactive behaviors
Draw Connector
Controls
Dropdown List
Controls
DVDController*
Components
Erase All Button
Paintbox
Fade In/Out
Animation > Automatic behaviors
Filter Input Characters
Text
Flash Cursor
Media > Flash
Flash Player Settings Panel
Media > Flash
Fly Through
3D > Actions
Follow Sprite
Animation > Interactive behaviors
Force Case
Text
Form Post - Dropdown List
Internet > Forms behaviors
Form Post - Field
Internet > Forms behaviors
Form Post - Hidden Field
Internet > Forms behaviors
Form Post - Submit Button
Internet >Forms behaviors
Format Numbers
Text
Generic Do
3D > Actions
Get Net Text
Text
Go Loop
Navigation
Go Next Button
Navigation
Go Previous Button
Navigation
Go to Frame X Button
Navigation
Go to URL
Navigation
Hold on Current Frame
Navigation
Hypertext - Display Status
Text
Hypertext - General
Text
Hypertext - Go to Marker
Text
Jump Back Button
Controls
Jump Forward Button
Controls
Jump to Marker Button
Controls
Jump to Movie Button
Controls
* New component in Director MX 2004
Alphabetical list of included behaviors
7
Behavior
Category > Subcategory
Jump when Media in Frame Is Available
Internet > Streaming behaviors
Jump when Media in Marker Is Available
Internet > Streaming behaviors
Jump when Member Is Available
Internet > Streaming behaviors
Keyboard Input
3D > Triggers
Label*
Components
Level of Detail
3D > Actions
List*
Components
Loop for X Seconds
Navigation
Loop Until Media in Frame Is Available
Internet > Streaming behaviors
Loop Until Media in Marker Is Available
Internet > Streaming behaviors
Loop Until Member Is Available
Internet > Streaming behaviors
Loop Until Next Frame Is Available
Internet > Streaming behaviors
Model Rollover Cursor
3D > Actions
Mouse Enter
3D > Triggers
Mouse Leave
3D > Triggers
Mouse Left
3D > Triggers
Mouse Right
3D > Triggers
Mouse Within
3D > Triggers
Move, Rotate, and Scale
Animation > Interactive behaviors
Multiple Sprite Drag
Animation > Interactive behaviors
Multi-state Button
Controls
NumericStepper*
Components
Orbit Camera
3D > Actions
Pan Camera Horizontal
3D > Actions
Pan Camera Vertical
3D > Actions
Password Entry
Text
Pause Sound
Media > Sound behaviors
Pixelate
Animation > Sprite transitions behaviors
Play Animation
3D > Actions
Play Done
Navigation
Play Frame X
Navigation
Play Movie X
Navigation
* New component in Director MX 2004
8
Using Director MX 2004 behaviors
Behavior
Category > Subcategory
Play Sound
Media > Sound behaviors
Progress Bar for Streaming Movies
Internet > Streaming behaviors
Progress Bar for URL Linked Assets
Internet > Streaming behaviors
Push Button
Controls
QuickTime Control Button
Media > QuickTime behaviors
QuickTime Control Slider
Media > QuickTime behaviors
RadioButton*
Components
Radio Button Group
Controls
Random Movement and Rotation
Animation > Automatic behaviors
RealMedia Buffering Indicator
Media > RealMedia
RealMedia Control Button
Media > RealMedia
RealMedia Slider Bar
Media > RealMedia
RealMedia Slider Knob
Media > RealMedia
RealMedia Stream Information
Media > RealMedia
RealMedia Target
Media > RealMedia
Reset Camera
3D > Actions
Rollover Cursor Change
Animation > Interactive behaviors
Rollover Member Change
Animation > Interactive behaviors
Rotate Camera
3D > Actions
Rotate Continuously (Frame Based)
Animation > Automatic behaviors
Rotate Continuously (Time Based)
Animation >Automatic behaviors
Rotate to Follow Path
Animation > Automatic behaviors
Rotation (Frame Based)
Animation > Automatic behaviors
Rotation (Time Based)
Animation > Automatic behaviors
Scale and Clip
Animation > Automatic behaviors
ScrollPane*
Components
Set Click Modes
Media > Flash behaviors
Set Playback Quality
Media > Flash behaviors
Set Scale, Origin, and View
Media > Flash behaviors
Show Axis
3D > Actions
Show Placeholder
Internet > Streaming behaviors
Slide In/Out
Animation >Automatic behaviors
* New component in Director MX 2004
Alphabetical list of included behaviors
9
Behavior
Category > Subcategory
Slide
Animation > Sprite transitions behaviors
Snap to Grid
Animation > Interactive behaviors
Soft Edge Wipe
Animation > Sprite transitions behaviors
Sound Beep
Media > Sound behaviors
Sprite Track Mouse
Animation > Interactive behaviors
Stop Sound
Media > Sound behaviors
Sub Division Surface
3D > Actions
Stretch
Animation > Sprite transitions behaviors
Sway
Animation > Automatic behaviors
TextArea*
Components
TextInput*
Components
Tickertape Text
Text
Toggle Redraw
3D > Actions
Tool Selector - Brush
Paintbox
Tool Selector - Eraser
Paintbox
Tooltip
Controls
Toon
3D > Actions
Tree*
Components
Turn to Fixed Point
Animation > Interactive behaviors
Turn Towards Mouse
Animation >Interactive behaviors
Turn Towards Sprite
Animation > Interactive behaviors
Typewriter Effect
Text
Undo Paint
Paintbox
Vector Motion
Animation > Interactive behaviors
Waft
Animation > Automatic behaviors
Wait for Mouse Click or Keypress
Navigation
Wipe
Animation >Sprite transitions behaviors
Zoom In/Out
Animation > Automatic behaviors
* New component in Director MX 2004
10
Using Director MX 2004 behaviors
3D behaviors
All interactive 3D behaviors in Director require an action, then a trigger. When you add an
action, it is good practice to assign similar actions to the same group. To establish a group, you
select a name for the group and enter that name in the Parameters dialog box of each behavior
that you attach to the sprites in the group. For example, you might assign Dolly Camera and Pan
Camera Horizontal to the same “Camera” group, while Create Box and Create Sphere would be
assigned to the same “Primitive” group. Assigning your behaviors to groups makes it much easier
to organize multiple behaviors and apply triggers to them.
You can add modifier keys to any trigger, so that a given trigger can launch two actions,
depending on whether the modifier key is pressed. You can, for example, use Mouse Left and
Mouse Left+Shift as separate triggers.
Independent 3D action behaviors (Orbit Camera, Automatic Model Rotation, Model Rollover
Cursor, Toon Behavior, and Show Axis) don’t need a trigger because they do simple things like
rotate models that do not require user interactions.
You can view more information about a particular 3D behavior, including parameters and
dependencies, if appropriate, by dragging a behavior to the Cast window, selecting it, and
displaying the Behavior inspector (Window > Behavior Inspector).
3D actions
Dolly Camera
moves the sprite’s camera in or out by a specified amount.
Drag Camera allows full camera control with a single behavior. Drag the camera for horizontal
and vertical panning, zooming, and rotation.
Fly Through
simulates flying through a 3D world. You can apply forward and reverse thrust, roll
to the left or right when turning, stop instantly, or glide to a smooth halt.
Pan Camera Horizontal pans the camera about its y-axis by the specified degree amount. For
vertical panning, use the Pan Camera Vertical behavior. For z rotation, use the Rotate Camera
behavior.
pans the camera bout its x-axis by the specified degree amount. For
horizontal panning, use the Pan Camera Horizontal behavior. For z rotation, use the Rotate
Camera behavior.
Pan Camera Vertical
Orbit Camera
allows the sprite’s camera to be orbitted about a specific model’s single or dual axis.
Reset Camera resets the sprite’s camera to its initial location values. Resetting the camera restores
the camera’s initial transform values.
Rotate Camera rotates the camera about its z-axis (clockwise or counterclockwise) by the
specified number of degrees. For y rotation, use the Pan Camera Horizontal behavior. For x
rotation, use the Pan Camera Vertical behavior.
Automatic Model Rotation
automatically rotates a model about an axis. For multiple axes, drop
multiple instances of the Automatic Model Rotation behavior on the sprite and select the desired
axes.
Click Model Go to Marker
allows the user to navigate to a specific frame in the Score by clicking
on a specific model.
Drag Model allows
the user to drag a model in any direction.
3D behaviors
11
Drag Model to Rotate allows the user to view all sides of a 3D model by rotating the model in
space. You can specify which axis, or pair of axes, the model can rotate about.
Model Rollover Cursor
changes the pointer to any of the available system pointers when the
mouse pointer is over a model.
Play Animation
allows the user to initiate an animation. Animations must be preexisting in the
cast member.
Create Box adds a box to the world. Boxes can be of preset or random width, height, and length.
Image cast members can be selected and wrapped around the box. You can vary the shader to
define how the box’s surface will look.
Create Particle System
produces numerous effects by varying its many settings. Fireworks and
explosions are examples of its uses. Gravity, wind, and drag can be applied to particles along
any axis.
Create Sphere
adds a sphere to the world. Spheres can be of preset or random diameter. Image
cast members can be selected and wrapped around the sphere. You can vary the shader to define
how the surface will look.
Level of Detail
enables the 3D level of detail modifier for the sprite and controls the amount of
detail that is put into a model. It dynamically scales the number of polygons used to render the
model depending on the model’s distance from the camera.
Sub Division Surface enables the subdivision surfaces modifier for the sprite and adds geometric
detail to models. Unlike the level of detail modifier, which removes detail, this modifier
synthesizes additional detail to smooth out curves as the camera gets nearer to the model. It may
cause performance problems if a model using this modifier is visible in more than one sprite or
camera at the same time.
Generic Do allows use of the trigger behaviors to send common strings to call custom handlers in
your own movie scripts.
Toggle Redraw allows the 3D redraw to be turned on or off. This has an effect that is similar to
setting the trails of a sprite. When set to FALSE, redraw is inactive, causing a trails effect. When set
to TRUE, redraw is turned on, preventing a trails effect.
Toon allows the imitation of a cartoon-style rendering of a model’s surface by applying a toon
modifier to the sprite. This modifier draws a model using only a handful of colors.
Show Axis draws axis lines for each model. This can be useful for debugging and is intended only
for this purpose. The blue line indicates the z-axis. The red line indicates the x-axis. The green
line indicates the y-axis.
3D triggers
Mouse Left enables other 3D action behaviors (rotate, zoom, etc.) to receive left mouse button
events (including events from the Macintosh mouse button).
Mouse Right
enables other 3D action behaviors (rotate, zoom, etc.) to receive right mouse
button events (including events from the Macintosh mouse button).
Mouse Enter
sends Mouse Enter event triggers to 3D action behaviors (rotate, zoom, etc.).
Mouse Within
sends Mouse Within event triggers to 3D action behaviors (rotate, zoom, etc.).
Mouse Leave
sends Mouse Leave event triggers to 3D action behaviors (rotate, zoom, etc.).
Keyboard Input
12
sends keyboard event triggers to 3D actions behaviors (rotate, zoom, etc.).
Using Director MX 2004 behaviors
Accessibility behaviors
Every accessibility behavior must begin with the Accessibility Target behavior. First you attach the
Accessibility Target behavior to a sprite, and then you add other accessibility behaviors as needed.
You can view more information about a particular accessibility behavior, including parameters
and dependencies, if appropriate, by dragging a behavior to the Cast window, selecting it, and
displaying the Behavior inspector (Window > Behavior Inspector).
Accessibility Target
is the main control behavior for accessibility behaviors. It acts as a focus
ring when the user tabs between items, and it allows accessibility behaviors to interact with
one another.
Accessibility Keyboard Controller
is used to respond to the user’s keyboard navigation.
Accessibility Group Order allows a sprite that has already had an Accessibility Item or
Accessibility Text Edit Item behavior applied to be assigned a tab order.
Accessibility Item allows the user to navigate sprites. For an editable text sprite, use the Edit Text
Item behavior instead.
Accessibility Text Edit Item allows the user to navigate editable text sprites. When the user types
a key, the key is spoken. If the sprite is not an editable text sprite, use the Accessibility Item
behavior instead.
Accessibility Speak
lets a string be spoken when the user tabs to or clicks on a sprite.
Accessibility Speak Member Text
lets the contents of a text member be spoken when the user
tabs to or clicks on a sprite.
Accessibility Speak Enable Disable
allows speech to be turned on, turned off, or toggled.
Accessibility Synch Caption
allows words spoken with the Accessibility Speak or Accessibility
Speak Member Text behaviors to be synchronized for display in a text captioning sprite.
Accessibility Captioning
displays a sprite’s spoken text.
Animation behaviors
The behaviors in the Animation library make sprites move in ways that would be difficult or
impossible to achieve using conventional Score-based animation. The Animation library has three
categories: Automatic behaviors, Interactive behaviors, and Sprite transitions behaviors. You can
view more information about a particular animation behavior, including parameters and
dependencies, if appropriate, by dragging a behavior to the Cast window, selecting it, and
displaying the Behavior inspector (Window > Behavior Inspector).
Automatic behaviors
The automatic behaviors function mostly on their own once they are activated.
Color Cycling changes the foreColor property of a sprite over time between two values set in the
Parameters dialog box. Set color values as palette index colors (0-255) or RGB values. You can set
the number of color cycles and the speed of the cycling.
Cycle Graphics cycles through a series of consecutive cast members. You define the first and last
cast members in the range. All cast members appear with their registration points in the same
location.
Animation behaviors
13
Fade In/Out makes a sprite gradually appear or disappear. You can set how fast and how many
times the fade occurs, as well as the minimum and maximum fade values. You can choose whether
the fade will be activated automatically in the sprite’s first frame, when the sprite is clicked, or
when the sprite is sent a message.
Random Movement and Rotation moves
and rotates a sprite randomly within a specific area.
You use the behavior parameters to define a boundary for the sprite’s movement and the speed of
movement and rotation. Two other settings determine the straightness of the path from point to
point and how far the sprite rotates before reversing.
Rotate Continuously (Frame Based) rotates
Rotate Continuously (Time Based) rotates
a sprite by a certain number of degrees per frame.
a sprite by a certain number of degrees per second.
Rotate to Follow Path makes a sprite rotate so that it always points in the direction it’s moving.
The behavior maintains the same rotation angle relative to the sprite’s path. You can change the
sprite’s initial rotation angle.
Rotation (Frame Based)
rotates a sprite by a given angle over a given number of frames. A
positive angle rotates a sprite clockwise; a negative angle rotates a sprite counterclockwise. An
angle greater than 360° results in more than one complete rotation.
Rotation (Time Based) rotates a sprite by a given angle over a given time. A positive angle rotates
a sprite clockwise; a negative angle rotates a sprite counterclockwise. An angle greater than 360°
results in more than one complete rotation.
Scale and Clip
changes the size of a Flash, QuickTime, or vector shape sprite over a number of
frames or over a given time period. You can set a start and finish size, or choose to scale to or from
the current size of the sprite. If you scale to more than 100%, the image is clipped.
Slide In/Out
makes sprites move in or out from the boundaries of the Stage. This behavior is
useful for presentations. You can specify whether the sprite should first appear at maximum (slide
in) or minimum (slide out) values, when the sliding should start, the minimum and maximum
slide values, the number of times the sprite should slide, and how fast the sprite should move.
Sway
rotates a sprite first one way and then the other by a given angle per frame for a given
number of frames. You can set the number of degrees to rotate in each frame, the number of
frames to move in each direction, the initial rotation angle, and whether the sway starts clockwise
or counterclockwise.
Waft
makes a sprite rise up on the screen like a bubble, rotating first one way and then the other
and vibrating horizontally as it rises.
Zoom In/Out makes a sprite smaller or larger over time. You can choose whether the zoom will be
activated automatically in the sprite’s first frame, when the sprite is clicked, or when the sprite is
sent a message. You can set up an endless loop, or set the zoom to occur only once.
Interactive behaviors
Interactive behaviors require some type of input from the user.
Avoid Mouse moves the current sprite away from the pointer. You can determine the speed of the
tracking, as well as the distance between the pointer and the center of the sprite. You can make
the behavior start automatically in the first frame of the sprite, or when the behavior receives a
message. The default setting for the behavior keeps the sprite from moving off of the Stage.
14
Using Director MX 2004 behaviors
Avoid Sprite
moves the current sprite away from another sprite. You define which sprite the
current sprite should avoid, how far away it should stay, and how fast the sprite moves. You can
make the behavior start automatically in the first frame of the sprite, or when it receives a
message. The default setting for the behavior keeps the sprite from moving off of the Stage.
Constrain to Line creates
a slider constrained to a straight line. Use the behavior parameters to
determine the direction in which the slider may be dragged. You can select a direction and a
distance the slider can move, or choose a point and a coordinate for the sprite to move toward.
The behavior broadcasts its current setting to other handlers.
Constrain to Sprite confines
a smaller sprite to the boundaries of a larger sprite. You can make
the constrained sprite draggable within the confines of the other sprite.
Drag and Toss
makes a sprite continue moving in the direction it is being dragged after the
mouse button is released. You must attach the Vector Motion behavior to a sprite before attaching
Drag and Toss.
Drag Quad Points changes a sprite so that it can be stretched and bent out of shape. With Drag
Quad Points attached to a sprite, you can click anywhere on the sprite and drag to make the
corner of the sprite nearest the pointer follow the movement of the mouse pointer. You can also
restore the sprite’s original shape and position.
Drag to Rotate
makes a sprite draggable and rotatable around its registration point.
Drag to Scale allows
the user to drag a sprite with the mouse to scale it while the movie plays.
Drag to Stretch and Flip
lets the user stretch a sprite vertically or horizontally and flip it at the
horizontal and vertical axes to create the appearance of a simple 3D rotation. You can also specify
a key combination to restore the sprite to its original size.
Draggable
makes a sprite draggable on the Stage while the movie plays.
Follow Sprite moves a sprite toward another sprite’s position. You define which sprite the current
sprite follows, how fast the sprite moves, and whether the behavior starts working as soon as the
sprite appears or when the behavior receives a message. The default setting for the behavior keeps
the sprite from moving off of the Stage.
Move, Rotate, and Scale assigns rotation and scaling control to selected keys. You can attach the
behavior to any sprite that can be scaled or rotated. If no modifier keys are pressed, clicking the
sprite and dragging moves the sprite.
Multiple Sprite Drag makes a group of sprites draggable as a single object. To create a group of
sprites, attach this behavior to each, and then assign the same name to the Drag Group parameter
in the Parameters dialog box. You can assign a single sprite to two or more groups to make it move
when any one of the sprites in any of the groups is moved.
Rollover Cursor Change replaces the pointer with a specified cast member when the pointer rolls
over the current sprite. You can specify a built-in pointer, a single cast member, or an animated
pointer.
Rollover Member Change
replaces the sprite’s cast member when the pointer rolls over the sprite.
Snap to Grid defines an invisible grid to which the current sprite is aligned. When the behavior is
active, clicking the sprite aligns it to the specified point on the grid. Each sprite with this behavior
attached may have a different grid and a different point to which it snaps. You can also apply the
behavior to a group of sprites so that each of them uses the same parameters. You can use
messages to reset parameters or enable or disable the behavior while the movie plays.
Animation behaviors
15
Sprite Track Mouse makes a sprite move so that it is always under the pointer. The sprite’s
registration point appears under the hotspot of the pointer.
Turn to Fixed Point makes a sprite always turn to face a given point on the Stage. This behavior
works only with cast member types that can be rotated and assumes that the sprite points left to
right when its rotation angle is 0.
Turn Towards Mouse makes a sprite face or turn away from the pointer, even if the sprite is
moving. The behavior assumes the sprite is facing to the right.
Turn Towards Sprite makes
a sprite face or turn away from any other sprite, even if one or both
sprites are moving. The behavior assumes the sprite is facing to the right.
Vector Motion moves a sprite in a straight line. Use Vector Motion with the Drag and Toss
behavior to change the motion of a sprite.
Sprite transitions behaviors
The sprite transitions behaviors control how a sprite moves onto or off of the Stage. You can
change the default settings of each of these behaviors when you drag the behavior onto a sprite.
Barn Door creates
a transition in which the bitmap or text sprite appears on a pair of opening or
closing doors, with one-half of the image on each door. The default settings specify that the
transition takes effect at the beginning of the sprite span (doors move from open to closed), the
transition occurs over a span of 10 frames, and the doors swing horizontally.
Pixelate creates a transition in which the bitmap or text sprite resolves from or into a grid of lowresolution pixels. The default settings specify that the transition takes effect at the beginning of
the sprite span (sprite resolves from low to high resolution), the transition occurs over a span
of 10 frames, the minimum number of pixels displayed horizontally and vertically is 3, and the
smallest dimension for a pixel during the transition is 4 x 4.
Slide
makes a bitmap or text sprite slide onto or off of the Stage from under the background.
The default settings specify that the transition takes effect at the beginning of the sprite span
(the sprite moves onto the Stage), the transition occurs over a span of 10 frames, and the sprite
moves from left to right.
Soft Edge Wipe
creates a transition in which the bitmap or text sprite appears on or is removed
from the Stage with a blend ranging from completely transparent to fully opaque. The default
settings specify that the transition takes effect at the beginning of the sprite span (the sprite moves
onto the Stage), the transition occurs over a span of 10 frames, the wipe blends from left to right,
and the width of the transition area from transparent to opaque is 15 pixels.
Stretch creates a transition in which the bitmap or text sprite stretches horizontally, vertically, or
in both directions. The default settings specify that the transition takes effect at the beginning of
the sprite span (the sprite appears compressed and then stretches to its final size), the transition
occurs over a span of 10 frames, and the sprite stretches from left to right.
Wipe
creates a transition in which the bitmap or text sprite appears on or is removed from the
Stage. The default settings specify that the transition takes effect at the beginning of the sprite
span (the sprite appears on the Stage), the transition occurs over a span of 10 frames, and the wipe
is displayed from left to right.
16
Using Director MX 2004 behaviors
Controls behaviors
The behaviors in the Controls library create user interface elements for your movies. You can view
more information about a particular controls behavior, including parameters and dependencies, if
appropriate, by dragging a behavior to the Cast window, selecting it, and displaying the Behavior
inspector (Window > Behavior Inspector).
Analog Clock makes a group of three vector shape sprites function as the hands of a clock. Place
each sprite on the Stage in its 12 o’clock position and then attach the behavior. You specify
whether each shape acts as the second, minute, or hour hand. The behavior rotates each sprite
around its base when the movie plays to indicate the current time according to the system clock.
The behavior will alter a sprite’s registration point if necessary.
Display Text displays a string in a field or text sprite. This behavior waits to be activated by
another behavior or a Lingo command. Use it with the Tooltip behavior or with your own custom
behaviors. You can make the text sprite invisible until requested by another behavior and specify
its location. You can choose between two display types: tooltip and status bar.
Draw Connector enables the user to draw straight lines with the mouse. You can also control this
behavior with Lingo calls from other sprites. The default setting starts drawing a line on
and completes the line on mouseUp. To let the user perform more sophisticated
drawing tasks, use the Paintbox behaviors (see “Paintbox behaviors”).
mouseDown
Dropdown List
changes a field cast member into a pop-up menu. You can set parameters so
that a list is displayed in the menu and commands are executed based on the user’s menu item
selection.
The following jump behaviors work together to provide navigation-control buttons that move the
playhead back and forth between markers in the current movie or a different movie. You can
attach these behaviors to buttons you have created with other behaviors. Each of these behaviors
works with the others by referring to a global navigation list that stores visited markers.
Jump Back Button sends the playhead to previously visited markers in all movies, moving back
through the navigation list stored by the other jump behaviors.
Jump Forward Button sends
the playhead through the path of visited markers previously stored
in the navigation list by the other jump behaviors.
Jump to Marker Button
sends the playhead to a chosen marker in the same movie and adds the
marker to a navigation list that is referred to by all the jump behaviors. (Use Jump to Movie to
move to a marker in a different movie.)
Jump to Movie Button sends the playhead to any other movie in the same folder (or in a
subfolder of this folder) and adds the destination to the navigation list. Enter a marker name as a
parameter to move to a point other than the first frame in the new movie. (Use Jump to Marker
to move to a marker in the current movie.)
Multi-state Button switches a sprite between off and on states. You can define a different cast
member that appears when the sprite is clicked, when the pointer rolls over the sprite, or when
the pointer is elsewhere. To create a group of buttons that function as radio buttons, give each
button in a group the same ID.
Push Button sets the cast member of a sprite based on the state of the mouse (elsewhere,
rollover, mouseDown, mouseUp). This creates a button that can initiate actions in other sprites.
Controls behaviors
17
Radio Button Group controls a group of radio button sprites so that selecting any button
deselects the others. Use radio button cast members created with the Tool palette, or use any
graphic cast member.
Tooltip works
with the Display Text behavior to display a single-line tooltip when the mouse
pointer rolls over a sprite. To use this behavior, attach the Tooltip behavior to the sprite that you
want to trigger the tooltip, and then attach the Display Text behavior to the text or field sprite
that will serve as the tooltip. Apply any text formatting for the tooltip to this sprite. Use the
Display Text behavior to make the tooltip appear at a fixed location or at the location requested
by the Tooltip behavior. You can also make the tooltip disappear when it is inactive or when it
remains on the Stage.
Internet behaviors
The behaviors in the Internet library control Internet-related functions. The Forms category of
the library contains behaviors for controlling CGI forms. The behaviors in the Streaming
category control a movie for optimal streaming.
You can view more information about a particular Internet behavior, including parameters and
dependencies, if appropriate, by dragging a behavior to the Cast window, selecting it, and
displaying the Behavior inspector (Window > Behavior Inspector). For more information about
streaming, see “About streaming with the Score and behaviors” in Director Help.
Forms behaviors
The forms behaviors let you send information from a form to a web server. All items with the
same form name are grouped together. If you are displaying more than one form on a single web
page, use the form name to specify what data is sent to the web server when the user clicks
Submit.
Form Post - Dropdown List defines an item name/value pair that will be sent along with other
POST data to a web server. You can attach this behavior to any field sprite that has the controls
Dropdown List behavior attached.
Form Post - Field
defines an item name/value pair that will be sent along with other POST data
to a web server. You can attach this behavior to a text or field sprite.
Form Post - Hidden Field
defines an item name/value pair that will be sent along with other
POST data to a web server. You can attach this behavior to a field sprite.
Form Post - Submit Button transfers the data defined by the other forms behaviors to a web
server. You can attach this behavior to any sprite.
Streaming behaviors
The streaming behaviors let you control how a movie plays while Shockwave media is
downloading from a server.
There are two types of streaming behaviors: jump and loop. Both wait for streaming media to
become available and then move the playhead to the next frame, a specified frame, or a specified
marker. The only difference between them is that jump behaviors loop the playhead on only a
single frame while the media is loading, whereas loop behaviors can loop the playhead over a
range of frames while the media is loading.
18
Using Director MX 2004 behaviors
Loop Until Next Frame Is Available
loops the playhead on one or more frames while media in
the next frame is loading. To use this behavior, drag it to the script channel of the Score and drop
it on the frame that should serve as the end of the looping sequence.
Loop Until Member Is Available
loops the playhead on one or more frames while media in a
specified cast member is loading. To use this behavior, drag it to the script channel of the Score
and drop it on the frame that should serve as the end of the looping sequence.
Loop Until Media in Frame Is Available loops the playhead on one or more frames while media
in a specified frame is loading. To use this behavior, drag it to the script channel of the Score and
drop it on the frame that should serve as the end of the looping sequence.
Loop Until Media in Marker Is Available loops the playhead on one or more frames while media
in a specified frame is loading. To use this behavior, drag it to the script channel of the Score and
drop it on the frame that should serve as the end of the looping sequence.
Jump when Member Is Available loops the playhead on a single frame while media in a specified
cast member is loading. To use this behavior, drag it to the script channel of the Score and drop it
on the frame that should be displayed while the media is loading.
Jump when Media in Frame Is Available loops the playhead on a single frame while media in a
specified frame is loading. To use this behavior, drag it to the script channel of the Score and drop
it on the frame that should be displayed while the media is loading.
Jump when Media in Marker Is Available loops the playhead on a single frame while media in a
specified marker range is loading. To use this behavior, drag it to the script channel of the Score
and drop it on the frame that should be displayed while the media is loading.
Progress Bar for Streaming Movies turns a sprite into a progress bar, indicating the progress of
the current movie’s stream. You can attach this behavior to any sprite that was drawn with the
Director drawing tools.
Progress Bar for URL Linked Assets turns a sprite into a progress bar, indicating the progress of
the stream of a linked asset. You can attach this behavior to any sprite that was drawn with the
Director drawing tools.
Show Placeholder
displays a simple box, a circle with a slash through it, or a custom vector
graphic in place of the cast member associated with a sprite until the cast member’s media has
been downloaded from a server. You can attach this behavior to any type of sprite, but it is
designed to be used with a graphic sprite. For this behavior to work, the Play while Downloading
Movie option must be selected in the Movie Playback Properties dialog box, and a sprite using
this behavior should not appear in frame 1 of the Score.
Media behaviors
The behaviors in the Media library control, alter, or otherwise manipulate specific types of media.
There are four media behavior categories: Flash, QuickTime, RealMedia, and Sound. You can
view more information about a particular media behavior, including parameters and
dependencies, if appropriate, by dragging a behavior to the Cast window, selecting it, and
displaying the Behavior inspector (Window > Behavior Inspector).
Media behaviors
19
Flash behaviors
Behaviors in the Flash library work only with Flash or vector shape sprites.
Flash Player Settings Panel
allows the user to access the Flash Player Settings panel with
the mouse.
Flash Cursor
allows the Director pointer to obey Flash pointer settings.
Set Click Modes determines
how a Flash sprite reacts to mouse clicks and whether the mouse
events are subsequently passed to Director. The default values are those of the cast member of the
current sprite. This behavior works only with Flash sprites.
Set Playback Quality changes the playback quality for Flash and vector shape sprites. The default
values are the settings of the current sprite.
Set Scale, Origin, and View
determines the scale, origin, and view for Flash and vector shape
sprites. The default values are the settings of the current sprite.
QuickTime behaviors
Behaviors in the QuickTime library work only with sprites containing QuickTime cast members.
QuickTime Control Button
makes almost any sprite a control button for QuickTime video
sprites. You can select the QuickTime sprite to control the action the button will perform.
QuickTime Control Slider controls a QuickTime digital video sprite like a video scrub controller.
Use in conjunction with the Constrain to Line behavior.
Real Media behaviors
Every RealMedia behavior must begin with the RealMedia Target behavior. First you attach the
RealMedia Target to a sprite, and then you can add other RealMedia behaviors as needed.
RealMedia Target
allows a RealMedia sprite to interact with RealMedia behaviors attached to
other sprites. This is the main control behavior for the RealMedia behavior library. On its own,
this behavior provides no control over the RealMedia sprite.
RealMedia Control Button
allows a sprite to function as a control button for a RealMedia target
sprite.
RealMedia Slider Bar
defines the horizontal limits of travel for the RealMedia Slider Knob
behavior.
RealMedia Slider Knob allows a sprite to be used as a slider to control and monitor the playback
location (current time) of a RealMedia sprite. By dragging the sprite to which this behavior is
attached, the user can change the current playing location in the RealMedia stream.
RealMedia Buffering Indicator allows a graphic sprite to provide a graphical display indicating
the buffering progress of a RealMedia sprite’s stream. Progress is indicated by changing the width
of the sprite from 0 to 100% of its initial width.
RealMedia Stream Information
allows a sprite to display textual playback information for a
RealMedia sprite. Choices to display include the percent buffered, media status, current time, and
file location (URL or path).
20
Using Director MX 2004 behaviors
Sound behaviors
Behaviors in the Sound library control how linked sound files are played.
To start, pause, or stop playing a sound, you use the Play Sound, Pause Sound, and Stop Sound
behaviors. You can attach the behavior to a sprite, the Stage, or a frame (in the script channel of
the Score). When attached to a frame, the behavior is triggered when the playhead enters or leaves
the frame. When attached to a sprite, the behavior is triggered by the beginning or end of the
sprite, or by mouse events.
Play Sound plays a linked sound file in a specified sound channel. If the sound channel contains
a sound that has been paused by the Pause Sound behavior, the sound resumes playing from
where it was paused. Otherwise, it plays from the beginning. You can attach this behavior to a
graphic sprite or to a sprite that contains a linked sound file.
Pause Sound pauses a sound that is playing in the specified sound channel. To begin playing a
sound or to resume a paused sound, use the Play Sound behavior.
Stop Sound
stops a sound that is playing in the specified sound channel.
Sound Beep plays
the system beep when the user clicks a graphic sprite.
Channel Volume Slider
turns a graphic sprite into a sliding control that controls the volume of
a sound.
Channel Pan Slider
turns a graphic sprite into a sliding control that controls the pan of a sound
from left to right.
Navigation behaviors
The Navigation library includes behaviors that move the playhead, open new movies, pause a
movie, and make the playhead return to previous locations. You can view more information about
a particular navigation behavior, including parameters and dependencies, if appropriate, by
dragging a behavior to the Cast window, selecting it, and displaying the Behavior inspector
(Window > Behavior Inspector).
Go Loop
moves the playhead back to the nearest marker when the user clicks the sprite.
Go Next Button
moves the playhead to the next marker when the user clicks the sprite.
Go Previous Button
moves the playhead to the previous marker when the user clicks the sprite.
Go to Frame X Button
Go to URL
moves the playhead to the specified frame when the user clicks the sprite.
opens the specified URL in a browser when the user clicks the sprite.
Hold on Current Frame loops the playhead in the current frame until another behavior sends the
playhead to a new location.
Loop for X Seconds
plays the current frame for the specified number of seconds.
Play Done returns the playhead to where the most recent Play command was issued. Attached to
a sprite, the behavior moves the playhead when the user clicks the sprite (on mouseUp). Attached
to a frame, the behavior moves the playhead when the playhead leaves the current frame (on
exitFrame).
Navigation behaviors
21
Play Frame X moves the playhead to the specified location. Attached to a sprite, the behavior
moves the playhead when the user clicks the sprite (on mouseUp). Attached to a frame, the
behavior moves the playhead when the playhead leaves the current frame (on exitFrame). Use
the Play Done behavior to end the sequence and return the playhead to the frame it was in before
jumping to the current sequence.
Play Movie X
moves the playhead to a given movie. Attached to a sprite, the behavior moves the
playhead when the user clicks the sprite (on mouseUp). Attached to a frame, the behavior moves
the playhead when the playhead leaves the current frame (on exitFrame). Use the Play Done
behavior to end the sequence and return the playhead to the frame it was in before jumping to the
current sequence.
Wait for Mouse Click or Keypress
displays a special pointer and holds the playhead in the
current frame until the mouse button is clicked or a key is pressed. You can specify whether
playback resumes after a mouse click, a keypress, or both. Drop this behavior directly onto the
desired frame in the script channel of the Score, or select the desired frame in the Score and then
drop this behavior onto the Stage.
Paintbox behaviors
Behaviors in the Paintbox library let the user create or modify bitmap images using the Director
drawing tools. You can view more information about a particular paintbox behavior, including
parameters and dependencies, if appropriate, by dragging a behavior to the Cast window,
selecting it, and displaying the Behavior inspector (Window > Behavior Inspector).
Canvas lets the user paint on a bitmap sprite. The default settings specify a round, black
paintbrush that is 10 pixels in size, and an opaque white background. You can specify different
values for these settings when you attach the behavior to a sprite.
Canvas is a “master” behavior that implements a single-color, single-size paintbrush. You can use
the other behaviors in this library to let the user switch drawing tools, change colors, and so on.
You can use the related Whiteboard behavior in the Multiuser library to share the canvas between
two or more movies. This can be useful when more than one person wants to view or modify the
same image.
Color Selector sets the paint color used by the Canvas behavior to the color of the pixel that the
user clicks on. This behavior can be attached to any type of sprite, but it is designed to be used
with bitmap sprites.
Erase All Button erases the contents of the canvas when the user clicks or double-clicks the sprite
to which the behavior is attached. You can attach this behavior to any sprite, but it is designed to
be attached to a sprite that can act as a button. To undo the erasure, use the Undo Paint behavior.
Tool Selector - Brush
defines the bitmap member to be used as a paintbrush by the Canvas
behavior.
Tool Selector - Eraser
lets the user erase with the Canvas behavior. You can attach this behavior
to any sprite, but it is designed to be attached to a sprite that can act as a button. You can attach
this behavior to the same button as the Erase All Button behavior, and set the Erase All Button
behavior so that it requires a double-click to function.
Undo Paint
is designed to be attached to a sprite that can act as a button. When the user clicks
the button, the Canvas behavior swaps its current image for the previous, unaltered image stored
by this behavior.
22
Using Director MX 2004 behaviors
Text behaviors
Behaviors in the Text library control and format text. You can view more information about a
particular text behavior, including parameters and dependencies, if appropriate, by dragging a
behavior to the Cast window, selecting it, and displaying the Behavior inspector (Window >
Behavior Inspector).
Add Commas to Numbers inserts commas into long numbers to make them easier to read. It can
display values with up to 14 significant figures. The number may be edited by the user, but only
numbers and the decimal point character (.) can be entered (no commas or spaces).
Calendar creates a calendar using a text cast member. The behavior works for any date between
the year 1901 and 2099. If you turn on the Enable Hyperlinks to Other Months option, the user
can step through the calendar by clicking < (previous) and > (next). To step through months or
years, first click the appropriate date item in the heading.
Countdown Timer changes a text or field sprite to make it count backward to 0 from the time set
in the Properties dialog box. The clock can count down a period of up to 24 days. It can display
days, hours, minutes, seconds, and hundredths of a second. When the timer runs out, the
behavior can send a global handler or a message to all sprites, depending on how you set
parameters. The behavior uses the font selected for the text or field cast member. The behavior
can also broadcast the current time to other sprites. The countdown can start in the first frame in
which the sprite appears, or it can wait for a message to begin.
Custom Scroll Bar creates dynamic scroll bars with your own artwork. Place four graphic sprites
on the Stage in proximity to a text sprite. Attach the behavior to each of the sprites and specify
whether it should serve as an up arrow, down arrow, dragger, or backing bar to scroll the text
sprite. You can also use two additional cast members to indicate that the arrow buttons have been
clicked: up arrow (clicked state), and down arrow (clicked state).
Filter Input Characters
restricts the characters that can be entered in a editable text or field
sprite. Invalid characters cause a system beep and do not appear. Enter the allowed characters,
including the space character, in the Parameters dialog box. The behavior can check for and
correct errors in case as well as characters. The behavior can handle all standard accented
characters if the font you are using can display them.
Force Case
converts all editable text or field cast member input to uppercase or lowercase
characters. This behavior is not suitable for accented letters, such as â, é, ï, õ, ù.
Format Numbers
displays numbers and monetary values in a variety of formats. Users can edit
the number without losing the format. The chosen format is applied when the user tabs to the
next field or clicks elsewhere.
Get Net Text retrieves text or HTML data from an Internet server. The behavior can interpret the
retrieved data as standard text or as HTML code (in text sprites only).
Hypertext - Display Status works with the Display Text behavior to display the destination URL
when the pointer rolls over a hypertext link. You can attach Hypertext - Display Status to a text or
field sprite containing a hypertext link. You can attach Display Text to the text or field sprite that
will serve as the tooltip.
Hypertext - General works
with text members containing hypertext link data to process URLs
and Lingo commands.
Hypertext - Go to Marker sends the playhead to the specified marker when the hypertext is
clicked. Use the Text inspector first to identify the hypertext.
Text behaviors
23
Password Entry changes a field or text sprite into a password entry field. The cast member’s font
should be set to Arial or Helvetica. The password field displays bullet characters instead of the
letters typed, and matches the letters typed with the valid password set in the Parameters dialog
box. The behavior can check for valid characters after every character entered or only when the
Return or Enter key is pressed. You define handlers to execute when the password is determined
to be valid or invalid.
Tickertape Text
scrolls the contents of a field or text cast member horizontally in a single line.
Typewriter Effect
makes a field or text sprite appear as if it were being typed onto the screen.
Attach this behavior to a text or field sprite containing all the text you want to display. The type
can begin to appear automatically in the first frame in which the sprite appears, or it can be set to
wait for a message. You can set the amount of time to wait between characters and play a sound
for each letter.
24
Using Director MX 2004 behaviors