Chapter 2: The Fireworks Object Model; Using The Fireworks Object Model - Adobe 65011817 - Fireworks CS4 - Mac Extended User Manual

Extending guide
Hide thumbs Also See for 65011817 - Fireworks CS4 - Mac:
Table of Contents

Advertisement

Last updated 12/8/2009

Chapter 2: The Fireworks Object Model

If you want to extend the functionality of Adobe Fireworks CS4 by writing or modifying a JavaScript extensibility file,
you must become familiar with the objects that Fireworks makes available through JavaScript. The hierarchy of these
objects comprises the Fireworks Object Model, which contains the following major components:
• Six global methods that are available from any part of the application and need not be declared as methods of a
particular object. For more information, see
• Core objects: Dialogs, Document, pngText, Errors, Files, Find, and System. For more information, see
objects" on page 16 and
supported for backward compatibility, but its use is deprecated in favor of the Fireworks object.)
• The Fireworks object (for more information, see
• Numerous objects associated with Fireworks documents, such as ExportOptions, Guides, Path, Image, and Text.
For more information, see
• A set of objects that you can use to specify the format of HTML code when exporting from Fireworks. For more
information, see
"HTML export

Using the Fireworks Object Model

When scripting extensions for Fireworks, you write JavaScript commands that send calls to the Fireworks Object
Model to determine or change the current settings for a Fireworks document. For example, the following command
calls the Fireworks object (
expressed as a file://URL. In other words,
is a property (for more information, see
resulting value to a variable, as follows:
var expSetDir = fw.appExportSettingsDir;
Accessing a Fireworks document
All the functions listed in
represents a Fireworks document. To perform a function on a Document object, you must first get the Document
Object Model (DOM) of the document. You then call the functions as methods of that DOM.
When accessing a Fireworks document, consider the following points:
• To use a DOM function with a document other than the active document, use the following syntax; note that
documentIndex is a zero-based index that specifies which document the command will affect.
fw.documents[documentIndex].functionName();
• To use a DOM function with the active document, use
information, see
fw.getDocumentDOM()
Passing values
For all properties that are not read-only, you can pass values to change elements of a document. For example, the
following command sets the fifth brush in the third open document to a square shape:
"Global
"The Document
object" on page 27. (The App object that was used in Fireworks 3 is
"Objects within Fireworks
objects" on page 270.
) to obtain the path to the Export Settings directory (
fw
references the Fireworks global object, of which
fw
"The Fireworks
"Property inspector
functions" on page 315 are methods of the Document object, which
).
methods" on page 13.
"The Fireworks
Object" on page 189).
documents" on page 236.
Object" on page 189), so a JavaScript command can assign the
fw.getDocumentDOM().functionName()
"Core
), which is
appExportSettingsDir
appExportSettingsDir
(for more
6

Advertisement

Table of Contents
loading

This manual is also suitable for:

Fireworks cs4

Table of Contents