How Behaviors Work; Inserting Multiple Functions In The User's File - MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Manual

Extending dreamweaver
Hide thumbs Also See for DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER:
Table of Contents

Advertisement

How Behaviors work

When a user selects an HTML element in a Dreamweaver document and clicks the Plus (+)
button, the following events occur:
Dreamweaver calls the
1
action is appropriate for the document or the selected element.
If the return value of this function is the value
Actions pop-up menu. (For example, the Control Shockwave action is dimmed when the user's
document has no SWF files.) If the return value is a list of events, Dreamweaver compares each
event with the valid events for the currently selected HTML element and target browser until
it finds a match. Dreamweaver populates the Events pop-up menu with the matched event
from the
canAcceptBehavior()
event for the HTML element (marked in the Event file with an asterisk [*]) becomes the top
item. The remaining events in the menu are assembled from the Event file.
The user selects an action from the Actions pop-up menu.
2
Dreamweaver calls the
3
dialog box. If the
determined automatically.
A dialog box always appears, with OK and Cancel buttons appearing at the right edge,
regardless of the contents of the
Dreamweaver displays a dialog box that contains the
4
Action file's
BODY
The user fills in the parameters for the action. Dreamweaver executes event handlers that are
5
associated with the form fields as the user encounters them.
The user clicks OK.
6
Dreamweaver calls the
7
Action file. These functions return strings that are inserted into the user's document.
If the user later double-clicks the action in the Actions column, Dreamweaver reopens the
8
Parameters dialog box and executes the
inspectBehavior()
that the user previously entered.

Inserting multiple functions in the user's file

Actions can insert multiple functions—the main behavior function plus any number of helper
functions—into the
as the function definition is exactly the same in each Action file. One way of ensuring that shared
functions are identical is to store each helper function in an external JavaScript file and insert it
into the appropriate Action files using
When the user deletes a behavior, Dreamweaver attempts to remove any unused helper functions
that are associated with the behavior. If other behaviors are using a helper function, it is not
deleted. Because the algorithm for deleting helper functions errs on the side of caution,
Dreamweaver might occasionally leave an unused function in the user's document.
236
Chapter 14: Behaviors
canAcceptBehavior()
function at the top of the list; if no match exists, the default
windowDimensions()
windowDimensions()
element.
BODY
tag contains an
onLoad
behaviorFunction()
function in the selected Action file, which fills in the fields with the data
section. Two or more behaviors can even share helper functions as long
HEAD
<SCRIPT SRC="externalFile.js">
function in each Action file to see whether this
, Dreamweaver dims the action in the
false
function to determine the size of the Parameters
function is not defined, the size is
elements of the Action file. If the
BODY
handler, Dreamweaver executes it.
and
applyBehavior()
handler. Dreamweaver then calls the
onLoad
functions in the selected
.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER and is the answer not in the manual?

This manual is also suitable for:

Dreamweaver mx 2004

Table of Contents