beautypg.com

The document object – Adobe Extending Flash Professional CS4 User Manual

Page 32

background image

10

EXTENDING FLASH CS4 PROFESSIONAL

Introduction

flash.closeAll();

fl.closeAll();

The flash object contains the following child objects:

The Document object

An important property of the top-level flash object is the

fl.documents

property. This property contains an array of

Document objects, each of which represents one of the FLA files currently open in the authoring environment. The
properties of each Document object represent most of the elements that a FLA file can contain. Therefore, a large
portion of the DOM is composed of child objects and properties of the Document object. For more information, see

Document object

.

To refer to the first open document, for example, use the statement

flash.documents[0]

or

fl.documents[0]

. The

first document is the first Flash document that was opened during the current session in the authoring environment.
When the first opened document is closed, the indexes of the other open documents are decremented.

To find a particular document’s index, use

flash.findDocumentIndex(

nameOfDocument

) or

fl.findDocumentIndex(

nameOfDocument

)

. See

fl.findDocumentIndex()

.

To access the document that is currently focused, use the statement

flash.getDocumentDOM()

or

fl.getDocumentDOM()

. See

fl.getDocumentDOM()

. The latter is the syntax used in most of the examples in this

document.

To find a particular document in the

fl.documents

array, iterate through the array and test each document for its

document.name

property

.

See

fl.documents

and

document.name

.

Object

How to access

actionsPanel object

Use

fl.actionsPanel

to access the actionsPanel object. This object corresponds

to the Actions panel in the Flash authoring environment.

compilerErrors object

Use

fl.compilerErrors

to access the compilerErrors object. This object

corresponds to the Compiler Errors panel in the Flash authoring environment.

componentsPanel object

Use

fl.componentsPanel

to access the componentsPanel object. This object

corresponds to the Components panel in the Flash authoring environment.

Document object

Use

fl.documents

to retrieve an array of all the open documents; use

fl.documents[index]

to access a particular document; use

fl.getDocumentDOM()

to access the current document (the one with focus).

drawingLayer object

Use

fl.drawingLayer

to access the drawingLayer object.

Math object

Use

fl.Math

to access the Math object.

outputPanel object

Use

fl.outputPanel

to access the outputPanel object. This object corresponds to

the Output panel in the Flash authoring environment.

presetPanel object

Use

fl.presetPanel

to access the presetPanel object. This object corresponds to

the Motion Presets panel (Window

> Motion Presets).

swfPanel object

Use

fl.swfPanels

to access an array of swfPanel objects. These objects

correspond to Window SWF panels.

Tools object

Use

fl.tools

to access an array of Tools objects.

XMLUI object

Use

fl.xmlui

to access an XML User Interface (XMLUI) object. The XMLUI object

provides the ability to get and set properties of an XMLUI dialog box.