beautypg.com

Fl.addeventlistener() – Adobe Extending Flash Professional CS4 User Manual

Page 243

background image

221

EXTENDING FLASH CS4 PROFESSIONAL

flash object (fl)

Usage

fl.actionsPanel

Description
Read-only property; an actionsPanel object, which represents the currently displayed Actions panel. For information
on using this property, see

actionsPanel object

.

fl.addEventListener()

Availability
Flash CS3 Professional.

Usage

fl.addEventListener(eventType, callbackFunction)

Parameters

eventType

A string that specifies the event type to pass to this callback function. Acceptable values are

"documentNew"

,

"documentOpened"

,

"documentClosed"

,

"mouseMove"

,

"documentChanged"

,

"layerChanged"

, and

"frameChanged"

.

The

documentChanged

value doesn’t mean that the content of a document has changed; it means that a different

document is now in the foreground. That is,

fl.getDocumentDOM()

will return a different value than it did before this

event occurred.

callbackFunction

The name of the function you want to execute every time the event occurs.

Returns
Nothing.

Description
Method; registers a function to be called when a specific event occurs.

When using this method, be aware that if the event occurs frequently (as might be the case with

mouseMove

) and the

function takes a long time to run, your application might hang or otherwise enter an error state.

Example
The following example displays a message in the Output panel when a document is closed:

myFunction = function () {

fl.trace('document was closed'); }

fl.addEventListener("documentClosed", myFunction);

See also

fl.removeEventListener()