ADOBE Fireworks CS3 User Manual

EXTENDING FIREWORKS
© 2007 Adobe Systems Incorporated. All rights reserved.
Adobe® Fireworks® Extending Fireworks®
If this guide is distributed with software that includes an end user agreement, this guide, as well as the software described in it, is furnished under license and may be used or copied only in accordance with the terms of such license. Except as permitted by any such license, no part of this guide may be reproduced, stored in a retrieval system, or trans­mitted, in any form or by any means, electronic, mechanical, recording, or otherwise, without the prior written permission of Adobe Systems Incorporated. Please note that the content in this guide is protected under copyright law even if it is not distributed with software that includes an end user license agreement.
The content of this guide is furnished for informational use only, is subject to change without notice, and should not be construed as a commitment by Adobe Systems Incorpo­rated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies that may appear in the informational content contained in this guide.
Please remember that existing artwork or images that you may want to include in your project may be protected under copyright law. The unauthorized incorporation of such material into your new work could be a violation of the rights of the copyright owner. Please be sure to obtain any permission required from the copyright owner.
Any references to company names in sample templates are for demonstration purposes only and are not intended to refer to any actual organization.
Adobe, the Adobe logo, Dreamweaver, Fireworks, Flash, Flex, Flex Builder, FreeHand, Illustrator, Photoshop, and Shockwave are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries.
Macintosh is a trademark of Apple Inc., registered in the United States and other countries. Windows is either a registered trademark or trademark of Microsoft Corporation in the United States and/or other countries. All other trademarks are the property of their respective owners.
Adobe Systems Incorporated, 345 Park Avenue, San Jose, California 95110, USA.
Notice to U.S. Government End Users. The Software and Documentation are "Commercial Items," as that term is defined at 48 C.F.R. §2.101, consisting of "Commercial Computer Software" and "Commercial Computer Software Documentation," as such terms are used in 48 C.F.R. §12.212 or 48 C.F.R. §227.7202, as applicable. Consistent with 48 C.F.R.
§12.212 or 48 C.F.R. §§227.7202-1 through 227.7202-4, as applicable, the Commercial Computer Software and Commercial Computer Software Documentation are being licensed to U.S. Government end users (a) only as Commercial Items and (b) with only those rights as are granted to all other end users pursuant to the terms and conditions herein. Unpublished-rights reserved under the copyright laws of the United States. Adobe Systems Incorporated, 345 Park Avenue, San Jose, CA 95110-2704, USA. For U.S. Government End Users, Adobe agrees to comply with all applicable equal opportunity laws including, if appropriate, the provisions of Executive Order 11246, as amended, Section 402 of the Vietnam Era Veterans Readjustment Assistance Act of 1974 (38 USC 4212), and Section 503 of the Rehabilitation Act of 1973, as amended, and the regulations at 41 CFR Parts 60-1 through 60-60, 60-250, and 60-741. The affirmative action clause and regulations contained in the preceding sentence shall be incorporated by reference.

Contents

Chapter 1: Extending Fireworks Overview
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Installing an extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
What’s new in Extending Fireworks CS3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Conventions used in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Additional resources for extension writers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2: The Fireworks Object Model
Using the Fireworks Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Using Fireworks API functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Using the common API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Working with selected objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Global methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Core objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
iii
Chapter 3: The Document object
Document functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Chapter 4: The Fireworks Object
Fireworks functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Chapter 5: Objects within Fireworks documents
Behavior object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Brush object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Contour object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
ContourNode object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
ContourNodeDynamicInfo object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
ControlPoint object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Effect object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
EffectList object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Element object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
ElementMask object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
ExportFrameInfo object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
ExportOptions object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
ExportPaletteInfo object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
ExportSettings object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Fill object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Frame object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
FrameNLayerIntersection object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Gradient object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
GradientNode object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Guides object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Layer object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
PathAttrs object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Pattern object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
RectanglePrimitive object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
RegisterMoveParms object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
SingleTextRun object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
SmartShape object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Style object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
TextAttrs object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
TextRuns object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Widget object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Chapter 6: HTML export objects
BehaviorInfo object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
BehaviorsList object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
exportDoc object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
ImageMap object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
ImagemapList object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
SliceInfo object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Slices object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
iv
Chapter 7: Cross-Product Extensions
Cross-product architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Flash panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Chapter 8: Auto Shapes
How Auto Shapes work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Creating an Auto Shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Chapter 9: Rich symbols
How Rich symbols work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
MXML Export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Chapter 10: Additional Fireworks Functions
Property inspector functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
History panel functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Static Document Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

Chapter 1: Extending Fireworks Overview

To extend Adobe® Fireworks® CS3, you must write JavaScript code. You can use JavaScript to write your own objects and commands that affect Fireworks documents and the elements within them. To accomplish these tasks, you must be proficient in JavaScript and in Fireworks.
This guide introduces the Fireworks Object Model, explains how to write cross-product extensions (extensions written in, or for, other Adobe applications), and discusses the JavaScript Auto Shape construction. The final chapter is a reference to the Fireworks JavaScript application programming interface (API)—the custom JavaScript functions that are built into Fireworks.

Prerequisites

Because Fireworks extensions must be written in JavaScript, this guide assumes that readers are familiar with JavaScript syntax and with basic programming concepts such as functions, arguments, and data types. It also assumes that readers understand the concept of working with objects and properties. This guide does not attempt to teach programming in general or JavaScript in particular.
1
Anyone who wants to extend Fireworks should have a good JavaScript reference to help with syntax questions (for example, is it Goodman (IDG), JavaScript: The Definitive Guide by David Flanagan (O’Reilly), and Pure JavaScript by R. Allen Wyke, Jason D. Gilliam, and Charlton Ting (Sams).
substring() or subString()?). Useful JavaScript references include JavaScript Bible by Danny

Installing an extension

As you start learning the process of writing extensions, you might want to explore the extensions and resources already available through the Adobe Exchange website (www.adobe.com/go/exchange). By installing an existing extension, you will become familiar with some of the tools that you need to work with your own extensions.
To install an extension: 1 Download and install the Extension Manager, which is available on the Adobe Downloads website
(www.adobe.com/exchange/em_download/).
2 Log on to the Adobe Exchange website (www.adobe.com/go/exchange).
3 Click the Fireworks Exchange link.
4 From the available extensions, choose one that you want to use. Click the Download link to download the
extension package.
5 Save the extension package in a directory on your machine.
6 In Fireworks, choose Commands > Manage Extensions to start the Extension Manager (or you can start
Extension Manager, located in the Adobe program group, independently from Fireworks).
7 In the Extension Manager, choose File > Install Extension, and choose the extension package you just saved.
The Extension Manager automatically installs the extension into Fireworks.
ADOBE FIREWORKS CS3
Extending Guide
You cannot begin using some extensions until you restart Fireworks. If you are running Fireworks when you install the extension, you might be prompted to quit and restart the application.
To view basic information on the extension after its installation, go to the Extension Manager (Commands > Manage Extensions) in Fireworks.

What’s new in Extending Fireworks CS3

Fireworks CS3 includes the following new features and interfaces that you can use to develop extensions for the product:
New page object Fireworks CS3 makes it easy to build complex multi-page web prototypes using a single PNG
file. A new object has been added to control this feature. In addition, a number of functions have been added to support sharing layers across pages, adding and reordering pages, setting a master page, renaming pages, and resizing the canvas or image for a single page rather than for the entire document.
Rich symbols Fireworks CS3 introduces new and enhanced symbol features. You can create graphic symbols that
can be intelligently scaled and given specific attributes using a JavaScript (JSF) file. A new added to support this feature.
widget object has been
2
9-slice scaling Fireworks CS3 introduces a dynamic new feature called 9-slice scaling, which allows you to intelli-
gently scale vector or bitmap symbols. By positioning a set of guides over your artwork, you can define exactly how each part of a symbol is scaled. Any of nine different regions can be specified to scale only horizontally, scale only vertically, scale both horizontally and vertically, or to not scale at all. A number of new functions have been added to support this feature.
Hierarchical layers In Fireworks CS3 the structure of layers in a document can be as simple or as complex as
required and all hierarchical layers are preserved. When creating a new file, all items are organized at the same level, in a non-hierarchical manner. You can create new sub layers as needed and move items into them, or move elements from one layer to another at any time. A number of new functions have been added to support this feature.
MXML export In Fireworks CS3 you can create Flex ™application layouts and export the MXML for loading into
Flex™ Builder™. A new chapter provides some background information on this process.

Conventions used in this guide

The following typographical conventions are used in this guide:
Code font indicates code fragments and API literals, including class names, method names, function names, type
names, scripts, SQL statements, and HTML and XML tag and attribute names.
Italic code font indicates replaceable items in code.
The continuation symbol (¬) indicates that a long line of code has been broken across two or more lines to fit on
the page. When copying the lines of code, eliminate the continuation symbol and type the code as one line.
Curly braces ({ }) around a function argument indicate that the argument is optional.
The following naming conventions are used in this guide:
Yo u refers to the developer who is responsible for writing extensions.
The user refers to the person using Fireworks.
ADOBE FIREWORKS CS3
Extending Guide
The visitor refers to the person who views the graphic that the user created.

Additional resources for extension writers

To communicate with other developers who are writing extensions, you can visit the Adobe online forums at
www.adobe.com/support/forums/.
3

Chapter 2: The Fireworks Object Model

If you want to extend the functionality of Adobe Fireworks CS3 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 “Global methods” on page 11.
Core objects: Dialogs, Document, pngText, Errors, Files, Find, and System. For more information, see “Core
objects” on page 13 and “The Document object” on page 20. (The App object that was used in Fireworks 3 is supported for backward compatibility, but its use is deprecated in favor of the Fireworks object.)
The Fireworks object (for more information, see “The Fireworks Object” on page 170).
Numerous objects associated with Fireworks documents, such as ExportOptions, Guides, Path, Image, and Text.
For more information, see “Objects within Fireworks documents” on page 208.
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 objects” on page 247.
4

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 ( is expressed as a file://URL. In other words,
tingsDir
can assign the resulting value to a variable, as follows:
var expSetDir = fw.appExportSettingsDir;
is a property (for more information, see “The Fireworks Object” on page 170), so a JavaScript command

Accessing a Fireworks document

All the functions listed in “Property inspector functions” on page 294 are methods of the Document object, which 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.
Note:
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 fw.getDocumentDOM().functionName() (for more
information, see
fw) to obtain the path to the Export Settings directory (appExportSettingsDir), which
fw references the Fireworks global object, of which appExportSet-
“fw.getDocumentDOM()” on page 188).

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:
ADOBE FIREWORKS CS3
Extending Guide
fw.documents[2].brushes[4].shape = "square";
The preceding example includes the following properties:
documents is a property of the Fireworks object and contains an array of Document objects.
brushes is a property of the Document object and contains an array of Brush objects.
shape is a property of the Brush object.
Note: Throughout this manual, optional arguments are enclosed in {braces}.

Fireworks Object Model calls and API calls

In some cases, you can use Fireworks Object Model calls or API calls to perform the same operations. In other cases, a certain function might be available in either the Fireworks Object Model or the API, but not in both.
For example, if the first open document is the current document, the first code fragment has the same effect as the second and third code fragments. The information, see “Accessing a Fireworks document” on page 4).
fw.getDocumentDOM().setDocumentResolution({pixelsPerUnit:72, units:"inch"});
fw.documents[0].resolution =72;
fw.documents[0].resolutionUnits ="inch";
fw.getDocumentDOM() function references the current document (for more
5

Formatting nonstandard data types

In addition to the standard data types that can be passed to functions as arguments, or used as properties, such as integer, string, and so on, Fireworks accepts other data types.
Some functions accept values that are Fireworks objects. For more information, see “The Fireworks Object Model”
on page 4.
Some functions accept a string in a specific format. Others accept value types that are not Fireworks objects but
are JavaScript object types that are specific to Fireworks. These types of arguments are described next, in alpha­betical order.
Color string data type
Functions that accept colors as arguments use the HTML syntax "#rrggbb". You can specify a color with an alpha (transparency) component by passing a longer string of the form
Mask data type
The format for a mask is {maskBounds: rectangle, maskKind: string, maskEdgeMode: string, featherA-
mount:
int, maskData: hex-string}.
maskBounds specifies the bounding rectangle of the mask area.
• Acceptable values for maskKind are "rectangle", "oval", "zlib compressed", "rle compressed", or
"uncompressed".
If the value of maskKind is "rectangle" or "oval", the maskData string is ignored, and a mask of the right shape
is constructed that fills
maskBounds and that has the edge specified by maskEdgeMode and featherAmount.
If the value of maskKind is "zlib compressed", "rle compressed", or "uncompressed", the maskData string
is presumed to contain 8-bit mask data in hexadecimal format that precisely matches the the mask.
"#rrggbbaa".
maskBounds to define
ADOBE FIREWORKS CS3
Extending Guide
Matrix data type
The format for a matrix is {matrix: [float, float, float, float, float, float, float, float,
float]}
. This guide assumes that you know how to use these nine values to construct a three-by-three transfor-
mation matrix; discussion of the construction of transformation matrices is beyond the scope of this manual.
Point data type
The format for a point is {x: float, y: float}. For instance, dom.addNewLine(startPoint, endPoint) could look like the following example:
fw.getDocumentDOM().addNewLine({x:64.5, y:279.5}, {x:393.5, y:421.5});
Rectangle data type
The format for a rectangle is {left: float, top: float, right: float, bottom: float}. For instance,
dom.addNewOval(boundingRectangle) could look like the following example:
fw.getDocumentDOM().addNewOval({left:72, top:79, right:236, bottom:228});
Resolution data type
The format for resolution is {pixelsPerUnit: float, units: string}. Acceptable values for units are "inch"
cm". For instance, dom.setDocumentResolution(resolution) could look like the following example:
or "
6
fw.getDocumentDOM().setDocumentResolution({pixelsPerUnit:72, units:"inch"});

Using Fireworks API functions

Three categories of API functions are described in this book: Document functions, History panel functions, and Fireworks functions. The following rules apply to all functions.

Zero-based indexes

Some functions take an index argument which is a zero-based, one-dimensional array. That means a value of 0 represents the first item in the array, deletes the second layer of the active Fireworks document:
fw.getDocumentDOM().deleteLayer2;
Functions that take a frameIndex argument can be passed –1 to indicate the current frame. Similarly, functions that take a
layerIndex argument may be passed –1 to indicate the current layer.

Passing null values

In general, passing a null value to a function causes an exception to be thrown. A few functions do allow null as an argument; such cases are noted in the function descriptions.
1 represents the second item, and so on. For example, the following command

Working with selected elements

Many API functions in this chapter refer to a “selection” or to “selected items.” These terms refer to Fireworks elements, such as text boxes or images, that are currently selected. In most cases, the functions work even if only one item is selected. If a function requires more than one selected item, this is noted in the description of the function.
ADOBE FIREWORKS CS3
Extending Guide

Palette or panel

Several API functions reference the History panel (see “History panel functions” on page 297). Throughout the Fireworks documentation and online help, the term palette is reserved for discussions of a color palette, and the term panel is used to refer to the floating windows that are available within Fireworks. Therefore, when the function name contains palette, the descriptions refer to a panel.

Using the common API

You can use the common Adobe API if you want commands to use a common syntax (and thus run a single command in multiple applications). You can access this API using currently supported in Fireworks and Dreamweaver to let developers easily create commands for both applications.

app.toggleFloater()

Identical to “fw.toggleFloater()” on page 204.

app.setFloaterVisibility()

Identical to “fw.setFloaterVisibility()” on page 203.
app.methodName().The following methods are
7

app.getRootDirectory()

Identical to the Fireworks object property “appDir •” on page 170.

app.browseDocument()

Identical to “fw.browseDocument()” on page 174.
Note: The app.getRootDirectory() function is useful if you want to use app.browseDocument() to view files within the applications’s folder.

Working with selected objects

When an object is selected, either programmatically (for example, using the dom.selectAll() function) or by a user, you can return (get) or set the value of that object’s properties using common notation that will work on various objects. In other words, you can write a command that will get or set the value of an object’s properties whether the user selects a Text object, or an Image object, or any other recognized object. In Fireworks, a recog­nizable object is classified as one of the following element types:
Hotspot
SliceHotspot (basically, a slice)
Path
Group
Instance
Text
RectanglePrimitive
PathAttrs
Image
To test whether a text block is selected, type the following code:
firstSelection = fw.selection[0];
if (firstSelection == "[object Text]"){
alert("I am a text block");
}
You can use the information in the following sections to return or set property values.
ADOBE FIREWORKS CS3
Extending Guide
8
Note: The return value for a property may be
null.

Working with properties for any selected object

You can get values for the following read-only properties of any type of selected object:
top
left
width
height
visible
opacity
blendMode
name
mask
To return the name of the selected object, type the following code:
objectName=fw.selection[0].name;
The following properties contain other read-only properties that you can return:
elementMask
element
linked
enabled
mode
showAttrs
autoExpandImages
effectList
namec
effects
ADOBE FIREWORKS CS3
Extending Guide
To return the name of the first effect that is applied to the selected object, type the following code:
effectName=fw.selection[0].effectList.effects[0].name;

Working with specific properties for selected elements

Some elements have specific properties that can be returned in addition to those that can be returned for any selected object (for more information, see “Working with properties for any selected object” on page 8). These specific properties are available for each of the following elements when the elements are selected.
Hotspot
shape
urlText
altText
targetText
contour
behaviors (returns an array of behaviors)
color
9
To re t ur n t he
altTag = fw.selection[0].altText;
SliceHotspot
alt tag that has been applied to the currently selected Hotspot, type the following code:
SliceHotspot is a subclass of Hotspot. A slice has all Hotspot properties, plus the following properties:
baseName
htmlText
tdTagText
sliceKind ("image" or "empty")
exportOptions
sliceID (read-only)
To return the name of the currently selected slice, type the following code:
sliceName = fw.selection[0].baseName;
Path
pathAttributes
Note: For the complete list of path attributes properties, see “pathAttributes” on page 98.
randSeed
textureOffset
contours
To return the value of the fill color for the currently selected path, type the following code:
fillColor = fw.selection[0].pathAttributes.fillColor
Group
elements
groupType
To return the number of objects in a selected group, type the following code:
numOfObjectsinGroup = fw.selection[0].elements.length;
Instance
symbolID
transformMode
instanceType
urlText
altText
targetText
To re t ur n t he
instance = fw.selection[0].instanceType;
instanceType for the currently selected instance, type the following code:
ADOBE FIREWORKS CS3
Extending Guide
10
Tex t
antiAliased
antiAliasMode
autoKern
orientation
pathAttributes
Note: For the complete list of
pathAttributes properties, see “pathAttributes” on page 98.
randSeed
textRuns
textureOffset
transformMode
To re t ur n t he
antiAliasedSetting = fw.selection[0].antiAliasMode;
RectanglePrimitive
antiAliasMode setting for the currently selected text block, type the following code:
Roundness
pathAttributes
Note: For the complete list of path attributes properties, see “pathAttributes” on page 98.
originalSides
transform
To return the roundness setting for the currently selected rectangle, type the following code:
roundness = fw.selection[0].roundness;
ADOBE FIREWORKS CS3
Extending Guide
pathAttributes
Several objects have the pathAttributes property. The following list is the valid set of pathAttributes sub properties that can be returned or set:
brushColor
fillColor
brush
fill
brushTexture
fillTexture
fillHandle1
fillHandle2
fillHandle3
brushPlacement
fillOnTop
To return the name of brush on the current path, type the following code:
11
brush = fw.selection[0].pathAttributes.brush.name;
(b

Global methods

The following are the global Fireworks methods, along with their argument data types and, where appropriate, acceptable values and notes.

alert(message)

Availability
Fireworks 3.
Usage
alert(message)
Arguments
message A string containing the message to display.
Returns
Nothing.
Description
Displays the message in a modal alert box, along with an OK button.

confirm(message)

Availability
Fireworks 3.
Usage
confirm(message)
Arguments
message A string containing the message to display.
Returns
True if OK is clicked, false if Cancel is clicked.
Description
Displays a string in a modal alert box, along with OK and Cancel buttons.

prompt(caption, text)

Availability
Fireworks 3.
ADOBE FIREWORKS CS3
Extending Guide
12
Usage
prompt(caption, text)
Arguments
caption A string containing the title of the dialog box.
text A string containing the prompt for the user.
Returns
The string entered if OK is clicked, null if Cancel is clicked.
Description
Prompts the user (with the string that is specified by text) to enter a string in a modal dialog box; the dialog box is titled with the string that is specified by caption.

write(arg1, arg2, ..., argN)

Availability
Fireworks 3.
Usage
write(arg1, arg2, ..., argN)
Arguments
arg1, arg2, ..., argN Srings containing content for output.
Returns
An output file.
ADOBE FIREWORKS CS3
Extending Guide
Description
Same as WRITE_HTML; WRITE_HTML was created to let you differentiate HTML output calls from other JavaS­cript calls in your code.

WRITE_CSS

Availability
Fireworks 3.
Usage
WRITE_CSS
Arguments
None.
Returns
An output file.
Description
Available only when exporting. Writes the CSS as an external file.
13

WRITE_HTML(arg1, arg2, ..., argN)

Availability
Fireworks 3.
Usage
WRITE_HTML(arg1, arg2, ..., argN)
Arguments
arg1, arg2, ..., argN Srings containing content for output.
Returns
An output file.
Description
Available only when exporting. Converts each argument to a string and writes it to the HTML output file. To enter an end-of-line character, use “\n”; this is converted to the correct line ending for your platform. For more infor­mation, see “HTML export objects” on page 247.

Core objects

This section describes the set of core objects that are always available: Errors, Files, Find, and System. The Document object is described within its own chapter: see “The Document object” on page 20.
Note: For information on how to format nonstandard data types, such as rectangle or point, see “Formatting
nonstandard data types” on page 5.
ADOBE FIREWORKS CS3
Extending Guide

Errors object

All Errors object properties are read-only strings that are used to simplify the localizing of scripts. They return localized error messages appropriate to the specific error. For example, the English version of Fireworks returns
"Memory is full." for the EOutOfMem property.
The following list contains the properties of the Errors object alphabetically:
EAppAlreadyRunning, EAppNotSerialized, EArrayIndexOutOfBounds, EBadFileContents, EBadJsVersion, EBadNesting, EBadParam, EBadParamType, EBadSelection, EBufferTooSmall, ECharConversionFailed, EDatabaseError, EDeletingLastMasterChild, EDiskFull, EDuplicateFileName, EFileIsReadOnly, EFileNotFound, EGenericErrorOccurred, EGroupDepth, EIllegalThreadAccess, EInternalError, ELowOnMem, ENoActiveDocument, ENoActiveSelection, ENoFilesSelected, ENoNestedMastersOrAliases, ENoNestedPasting, ENoSliceableElems, ENoSuchElement, ENotImplemented, ENotMyType, EOutOfMem, EResourceNotFound, ESharingViolation, EUnknownReaderFormat, EUserCanceled, EUserInterrupted, EWrongType

Files object

The following table lists the methods of the Files object, along with their data types and, where appropriate, acceptable values and notes.
Method Data type Notes
14
copy(docname1, docname2)
createDirectory(dirname)
createFile(fileURL, fileType, fileCreator)
deleteFile(docOrDir)
deleteFileIfExisting (docOrDir)
string, string Copies the file specified in the first argument to
string Creates the specified directory. Returns true if
string, string, string Creates the specified file. The file must not
string Deletes the specified file or directory. Returns
string Deletes the specified file or directory. Returns
the file specified in the second argument. Each argument must be the name of a file, which is expressed as file://URL. Only files (not directories) can be copied. The files do not need to reside on the same drive, and the method does not over­write a file if it already exists. Returns a value of
true if the copy is successful; false other-
wise.
successful; false otherwise.
already exist. The first argument is the name of the file, which is expressed as file://URL. The last two arguments let you specify the file type and file creator strings. The
fileCreator strings should each be strings
of exactly four characters in length, for example:
Files.create­File(newFile,".txt","FWMX");
true if successful; false if the file or directory
does not exist or cannot be deleted. Compare with
deleteFileIfExisting().
true if successful; false if the file or director y
cannot be deleted. Unlike this method returns does not exist.
fileType and
deleteFile(),
true if the file or directory
Method Data type Notes
ADOBE FIREWORKS CS3
Extending Guide
15
enumFiles(docOrDir)
exists(docOrDir)
getDirectory(docname)
getExtension(docname)
getFilename(docname)
getLanguageDirectory()
getLastErrorString()
string Returns an array of file URLs. If docOrDir is
string Returns true if docOrDir refers to a directory
string Returns only the directory name from docname,
a directory, the array contains an entr y for every file or directory that is contained in the specified directory. If docOrDir is a file, the array contains a single entry (the file passed in).
or file that exists; false otherwise.
which is expressed as file://URL. For example,
Files.getDirec­tory("file://work/logo.png")
returns "file:///work".
string Returns the filename extension, if any, of
docname. For example, Files.getExten­sion("birthday.png")
If the filename has no extension, an empty string is returned. A filename that is expressed as file://URL is acceptable.
string Returns just the filename from docname, which
is expressed as file://URL. For example,
returns ".png".
Files.getFile­name("file:///work/logo.png")
returns "logo.png".
string Returns the URL of the language directory associ-
ated with the currently running language.
none If the last call to a method in a Files object
resulted in an error, returns a string that describes the error. If the last call succeeded, returns null.
getTempFilePath ({dirname})
isDirectory(dirname)
makePathFromDirAndFile(dir name, plainFilename)
string The argument, if used, must be expressed as
string The argument must be expressed as file://URL.
string, string The first argument must be expressed as
file://URL. Returns a file URL in the Temporary Files directory or in the specified directory. This method does not create a file; it simply returns a unique file URL that does not conflict with existing files in the directory. If dirname is passed and is not indicates a file in the specified directory rather than in the Temporary Files directory.
Returns true if the specified URL refers to a directory that exists;
file://URL. Concatenates the two arguments to return a file URL that references the specified file­name in the specified directory. For example,
null, the URL that is returned
false otherwise.
Files.makePathFromDirAnd­File("file:///work/reports", "logo.png")
returns
"file:///work/reports/logo.png" .
Method Data type Notes
ADOBE FIREWORKS CS3
Extending Guide
16
open(docname, bWrite)
rename(docname, newPlainFilename)
setFilename(docname, newPlainFilename)
swap(docname1, docname2)
string, Boolean The first argument must be expressed as
string, string The docname argument is a file path or a file
string, string The first argument must be expressed as
file://URL. Opens the specified file for reading or writing. If the second argument is true, the file opens for writing; otherwise it opens for reading. If the file cannot be opened, returns null; otherwise, returns a File Reference object.
URL to the file that you want to rename.
The newPlainFilename argument is the new name to assign to the file.
The rename method returns a URL path of the newly renamed file if successful; otherwise Fire­works returns null.
file://URL. Returns a file URL with docname replaced by newPlainFilename. For example, Files.setFile-
name("file:///work/logo.png", "oldlogo.png")
returns
"file:///work/oldlogo.png". This
method does not affect the file on disk; it simply provides a convenient way to manipulate file URLs. To change the name on disk, use
rename().
string, string Each argument must be expressed as a file://URL.
Swaps the contents of the two specified files, so that each file contains the contents of the other file. Only files (not directories) can be swapped, and both files must reside on the same drive. Returns true if the swap is successful; false otherwise.
File Reference object
The File Reference object is used to refer to a specific open file. The following table lists the methods of the File Reference object, along with their data types and, where appropriate, acceptable values and notes.
Method Data Type Notes
close()
readline()
write(textString)
none Closes the current File Reference object. You are not
none Reads the next line from the current File Reference
string Writes the specified string to the current File Refer-
required to use this method (the file is closed when the Files object is destroyed), but it is useful for controlling access to a file.
object and returns it as a string. The end-of-line char­acter(s) are not included in the string. Returns if end-of-file is reached or if the line is longer than 2048 characters.
ence object. No end-of-line characters are appended; to include one, use "\n".
null
ADOBE FIREWORKS CS3
Extending Guide

Find object

There are several ways to specify a Find object, depending on what you want to find and replace. Use the
whatToFind property to specify the type of find operation, along with the properties that are associated with each
legal value for a bullet (•).
Finding and replacing text
Property Data type Notes
whatToFind. These properties are listed in the following tables. Read-only properties are marked with
17
whatToFind
find
matchCase
regExp
replace
wholeWord
string In the format: "text"
string Text to find.
Boolean If set to true, the search is case-sensi tive. Defaults to
false.
Boolean If set to true, the find and replace text is interpreted
as a regular expression. The default is false.
string Text to use as replacement text.
Boolean If set to true, only whole words matching the search
text are found. The default is false.
Finding and replacing fonts and styles
Property Data type Notes
whatToFind
find
replace
findStyle
string In the format: "font"
string Name of font to find.
string Name of font to use as replacement.
integer Number that represents the style to find:
AnyStyle = -1
Plain = 0
Bold = 1
Italic = 2
BoldItalic = 3
Underline = 4
BoldUnderline = 5
ItalicUnderline = 6
BoldItalicUnderline = 7
replaceStyle
findMinSize
findMaxSize
replaceSize
integer Number that represents the style to be used as
replacement.
integer 0 to 9999
integer 0 to 9999
integer 0 to 9999, or pass -1 to leave size as is
Finding and replacing colors, fills, strokes, and effects
Property Data type Notes
ADOBE FIREWORKS CS3
Extending Guide
18
whatToFind
find
replace
fills
strokes
effects
string In the format: "color"
string A color string that specifies the color to f ind (for more
information, see “Color string data type” on page 5).
string A color string that specifies the color to use as a
replacement (for more information, see “Color string data type” on page 5).
Boolean If set to true, fills that match the specified colors are
replaced.
Boolean If set to true, strokes that match the specified colors
are replaced.
Boolean If set to true, effects that match the specified colors
are replaced.
Finding and replacing URLs
Property Data types Notes
whatToFind
find
replace
wholeWord
string In the format: "url"
string URL to find, which is expressed as file://URL.
string URL to use as replacement text, which is expressed as
file://URL.
Boolean If set to true, only whole words that match the
search text are found. The default is false.
matchCase
Boolean If set to true, the search is case sensitive. Defaults to
false.
regExp
Boolean If set to true, the find and replace text is inter-
preted as a regular expression. The default value is
false.
Finding and replacing non-websafe colors with the closest websafe color
Property Data type Notes
whatToFind
effects
fills
strokes
string In the format: "nonwebcolor"
Boolean If set to true, colors in effects are replaced. The
Boolean If set to true, colors in fills are replaced. The default
Boolean If set to true, colors in strokes are replaced. The
default value is
value is
false.
default value is
false.
false.

System object

The following table lists the properties of the System object, along with their data types and, where appropriate, acceptable values and notes. All System properties are read-only.
Property (read-only) Data type Notes
ADOBE FIREWORKS CS3
Extending Guide
19
osName
controlFaceColor
controlHilightColor
controlShadowColor
controlDarkShadowColor
hilightItemColor
hilightTextColor
textColor
menuColor
menuTextColor
string Returns the name of the operating system under
which Fireworks is running.
string Returns the system color used for the control and
panel faces (Windows-only property).
string Returns the system color used for control highlights
(Windows-only property).
string Returns the system color used for control shadows
(Windows-only property).
string Returns the system color used for control dark
shadows (Windows-only property).
string Returns the system color used for highlighting selec-
tions (Windows-only property).
string Returns the system color used for highlighting
selected text (Windows-only property).
string Returns the system color used for text ( Windows-only
property).
string Returns the system color used for menu backgrounds
(Windows-only property).
string Returns the system color used for text in menus
(Windows-only property).

Chapter 3: The Document object

This chapter describes the Fireworks Document object and functions.
The following table lists the properties of the Document object, along with their data types, acceptable values and notes. Read-only properties are marked with a bullet (•). You can also use many API calls to work with documents. For more information, see “Property inspector functions” on page 294.
Property Data type Notes
20
backgroundColor
backgroundURL
brushes •
currentFrameNum
currentLayerNum
defaultAltText
docTitleWithoutExtensio n
exportFormatOptions
exportOptions
string A color string that specifies the document canvas
color (for more information, see “Color string data type” on page 5).
string Sets a general URL for a document that uses a
Hotspot. Everything that is not covered by the Hotspot has the background URL.
array Array of Brush objects that are available for use in the
document (for more information, see “Brush object” on page 208).
zero-based index The index of the current frame.
zero-based index The index of the current layer.
string Default Alt text for the output images. It works for
single and sliced images. Sliced images get the default, unless specific text is specified for a slice. Corresponds to the text that is specified in File > HTML Properties > ImageMap > AltImageDescription.
string The title of the document file, without any file exten-
sion. If the document has not been saved, this string is empty.
object Identical to exportOptions. Included for back-
ward compatibility with Fireworks 2.
object ExportOptions object (for more information, see
“ExportOptions object” on page 227).
exportSettings
filePathForRevert
filePathForSave
fills •
frameCount
object ExportSettings object (for more information, see
string The path to the file from which this document was
string The location to which this document was saved,
array Array of Fill objects that are available for use in the
integer The number of frames in the current document.
“ExportSettings object” on page 230).
opened, which is expressed as file ://URL, or null if created from scratch.
which is expressed as file://URL, or saved.
document (for more information, see “Fill object” on page 233).
null if never
Property Data type Notes
ADOBE FIREWORKS CS3
Extending Guide
21
frameLoopingCount
frames •
gammaPreview
gradients •
gridColor
gridOrigin
gridSize
guides •
height
integer –1 — don’t repeat
0 — repeat forever
> 0 — repeat this number of times
array Array of Frame objects in the document (for more
Boolean If set to true, the document should be previewed in
array Array of Gradient objects that are available for use in
string A color string that specifies the color of the grid
point Used to set the origin of the grid. Corresponds to the
point gridSize.x is the horizontal grid size; grid-
object Guides object (for more information, see “Guides
integer Total height of the document, in pixels. To find the
information, see “Frame object” on page 234).
opposite-platform gamma. If set to false, the document colors are unadjusted.
the document (for more information, see “Gradient object” on page 235).
display (for more information, see “Color string data type” on page 5).
point set when dragging the ruler origin from the upper-left of the document when rulers are visible.
is the vertical grid size.
Size.y
object” on page 235).
bottom edge of the document, use document.
top + document.height.
isDirty
isPaintMode •
isSymbolDocument •
isValid
lastExportDirectory
lastExportFile
Boolean Set to true if the document was modified since the
Boolean Set to true if the document is currently in paint-
Boolean Set to true if the document is a Symbol or Button
Boolean Set to true if the document is open in Fireworks;
last ti me it was saved.
mode editing, false otherwise.
document, might see this when looking through the list of open documents and one is a symbol-editing window.
false if it is an ordinary document. You
false otherwise. (Occasionally the JavaScript
object that is associated with a document lingers after the document closes; this property lets you check for that eventuality.)
string The path to the last directory to which the file was
string The name that was used the last time the file was
exported, which is expressed as file://URL, or the file was never exported. For instance, if the docu­ment was last exported to "file:///files/current/logo.gif", it returns
"file:///files/current".
exported, or instance, if the document was last exported to
null if the file was never exported. For
null if
"file:///files/current/logo.gif", it
returns
"logo.gif".
Property Data type Notes
ADOBE FIREWORKS CS3
Extending Guide
22
layers •
left
mapType
matteColor
onionSkinAfter
onionSkinBefore
pageName
patterns •
pathAttributes
array An array of Layer objects in the document (for more
information, see “Layer object” on page 236).
integer Coordinate of the left edge of the document, in pixels.
To find the right edge of the document, use docu-
ment.left + document.width.
string Acceptable values are "client", "server", and
"both". Corresponds to the image-map type
selected in File > HTML Properties > ImageMap.
string A color string that corresponds to the matte color
specified in the Optimize panel (for more information, see “Color string data type” on page 5). This string is used by the useMatteColor property.
integer Number of frames after the current frame to show
through onion skinning. Corresponds to the onion­skin controls in the left edge of the Frames panel. A value of 0 indicates no onion skinning; a very large value (such as 99,999) indicates onion skinning of all frames after the current frame.
integer Similar to the onionSkinAfter property,
but refers to the number of frames to show through onion skinning before the current frame.
string Returns back the page name of the current page.
object List of internal pattern names.
object PathAttrs object (for more information, see “PathAttrs
object” on page 236). This object specifies default attributes that will be applied to all newly created objects.
pngText
resolution
resolutionUnits
savedSelections
textures
object A structure that can be used to store various chunks
of text in a well-known format. For more information, see “The pngText property” on page 23.
float Document resolution, in pixels per unit (for more
information, see resolutionUnits). The range is 1 to 5000.
string The units to be used with the resolution prop-
erty. Acceptable values are "inch" and "cm".
object Array of the saved bitmap selections in the active
document.
array Array of Texture objects that are available for use in
the document (for more information, see “Texture object” on page 226).
Property Data type Notes
ADOBE FIREWORKS CS3
Extending Guide
23
top
useMatteColor
width
integer Coordinate of the top edge of the document, in
pixels. To find the bottom edge of the document, use
document.top + document.height.
Boolean If set to true, the matteColor property is used
when exporting documents with transparent back­grounds. If set to false, the matteColor prop­erty is ignored in this situation, and the exported file is matted against the document’s canvas color.
integer The width of the document, in pixels. To find the right
edge of the document, use document.left +
document.width.

The pngText property

Fireworks maintains the following fields for use with the pngText property:
Field name Value
CreationTime
Software
You can edit these or add your own fields, and they will be preserved across file saves.
The pngText object corresponds directly to the
The date and time the document was created.
The software used to create the document. The current version of Fireworks always sets this value to “Adobe Fireworks CS3.”
'tEXt' chunk of the document’s PNG structure.

Document functions

As discussed in an earlier section, you get and set document properties by calling functions as methods of the document’s Document Object Model (DOM) (see “Accessing a Fireworks document” on page 4). Methods that operate on a document’s DOM are listed in this section as
dom.functionName(). In place of dom, you must type fw.getDocumentDOM() or fw.documents[documentIndex]. For example:
How a function looks in this manual: dom.addNewHotspot()
How you must type it:
fw.getDocumentDOM().addNewHotspot(); // operates on active document
or
fw.documents[documentIndex].addNewHotspot(); // operates on specified document

dom.addBehavior()

Availability
Fireworks 3.
Usage
dom.addBehavior(action, event, eventIndex)
dom.functionName(). However, you cannot simply type
ADOBE FIREWORKS CS3
Extending Guide
Arguments
action A string that specifies the behavior to be added, such as "MM_swapImageRestore()". For a list of all the
behaviors that can be added, see “Using the dom.addBehavior() function” on page 24.
event The event that triggers the behavior. Acceptable values are "onMouseOver", "onMouseOut", "onLoad",
"onClick".
and
eventIndex An integer value that specifies the location where the behavior should be added, starting with 0
(although, to specify the end location, pass
–1 here).
Returns
Nothing.
Description
Adds a specified behavior to the selected hotspots and slices.
Example
The following command adds a simple rollover behavior at the end of the selected slice or hotspot:
fw.getDocumentDOM().addBehavior("MM_simpleRollover()", "onMouseOver", -1);
24
See also
dom.removeBehavior()
Using the dom.addBehavior() function
The following code shows the syntax for dom.addBehavior():
fw.getDocumentDOM().addBehavior(action, event, eventindex);
The first argument is a string that specifies the behavior to be added; see “dom.addBehavior()” on page 23. The infor­mation in this section describes the acceptable values for the
havior()
MM_nbGroup [down]
.
action argument that is passed to dom.addBe-
Availability
Fireworks 3.
Arguments
type, barName, target, swapFrame, fileName, preload
Pass "down" for type.
Pass "navbar1" for the name of the navigation bar.
target specifies the slice to which the behavior is attached. Pass –1 for this value; all other values are used inter-
nally by Fireworks.
swapFrame is an integer value that specifies the frame to swap, starting with 0 (although, to use fileName as a
URL, pass
–1 here).
fileName specifies the frame or file to swap. If you specified a frame to use in swapFrame, pass an empty text
string. If you want to specify a filename and you passed
–1 for swapFrame, pass the string for the relative URL of
the image.
ADOBE FIREWORKS CS3
Extending Guide
preload is a binary value that specifies whether to preload the swapped image (pass 1) or not (pass 0).
Description
Sets a navigation bar Down behavior.
Example
fw.getDocumentDOM().addBehavior("MM_nbGroup(\'down\',\'navbar1\',-1,2,\"\",1)", "onClick", -1);
MM_nbGroup [highlight]
Availability
Fireworks 3.
Arguments
type, target, swapFrame, fileName, preload, downHighlight, downHighlightFrame, downHighlightFilename
Pass "over" for type.
target specifies the slice to which the behavior is attached. Pass –1 for this value; all other values are used inter-
nally by Fireworks.
swapFrame is an integer value that specifies the frame to swap, starting with 0 (although, to use fileName as a
URL, pass
–1 here).
25
fileName specifies the frame or file to be swapped. If you specified a frame to use in swapFrame, pass an empty
text string. If you want to specify a filename and you passed
–1 for swapFrame, pass the string for the relative
URL of the image.
preload is a binary value that specifies whether to preload the swapped image (pass 1) or not (pass 0).
downHighlight is a binary value that specifies whether an image should be used for highlighting on mouse down
1) or not (pass 0). If you pass 1, use the next two arguments to specify the frame or image to be used.
(pass
downHighlightFrame is an integer value that specifies the frame to use as a highlight image, starting with 0
(although, to use
downHighlightFrame as a URL, pass –1 here).
downHighlightFilename specifies the frame or file to be used as the highlight image. If you specified a frame to
downHighlightFrame, pass an empty text string. If you want to specify a filename and you passed –1 for
use in
downHighlightFrame, pass the string for the relative URL of the image.
Description
Sets a navigation bar highlight behavior.
Example
fw.getDocumentDOM().addBehavior("MM_nbGroup(\'over\',-1,1,\"\",1,0,3,\"\")", "onMouseOver", -1);
MM_nbGroup [image]
Availability
Fireworks 3.
Arguments
type, downHighlight, initiallyDown
ADOBE FIREWORKS CS3
Extending Guide
Pass "all" for type.
downHighlight is a binary value that specifies whether the image should be highlighted on a mouse Down action
1) or not (pass 0).
(pass
initiallyDown is a binary value that specifies whether the image should initially appear as in the Down state
1) or not (pass 0).
(pass
Description
Sets a navigation bar image behavior.
Example
fw.getDocumentDOM().addBehavior("MM_nbGroup(\'all\',1,0)", "onMouseOver", -1);
MM_nbGroup [out]
Availability
Fireworks 3.
Arguments
type Pass "out" for type.
26
Description
Sets a navigation bar restore behavior.
Example
fw.getDocumentDOM().addBehavior("MM_nbGroup(\'out\')", "onMouseOut", -1);
MM_simpleRollover
Availability
Fireworks 3.
Arguments
None.
Description
Adds a simple rollover behavior.
Example
fw.getDocumentDOM().addBehavior("MM_simpleRollover()", "onMouseOver", -1);
MM_statusMessage
Availability
Fireworks 3.
Arguments
message A string that specifies the status message to appear.
Description
Sets a status bar message.
Loading...
+ 285 hidden pages