ADOBE Fireworks CS5 User Manual

Extending
ADOBE® FIREWORKS
®

Legal notices

Legal notices
For legal notices, see http://help.adobe.com/en_US/legalnotices/index.html.
Last updated 5/17/2012

Contents

Chapter 1: Extending Fireworks Overview
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Installing an extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
What’s new in Extending Fireworks CS5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Conventions used in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Additional resources for extension writers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Chapter 2: The Fireworks Object Model
Using the Fireworks Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Using Fireworks API functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Using the common API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Working with selected objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Global methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Core objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Adobe AIR Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Chapter 3: The Document object
Document object properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Document functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Chapter 4: The Fireworks Object
Fireworks functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Chapter 5: Objects within Fireworks documents
Behavior object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Brush object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Contour object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
ContourNode object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
ContourNodeDynamicInfo object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
ControlPoint object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Effect object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
EffectList object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Element object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
ElementMask object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
ExportFrameInfo object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
ExportOptions object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
ExportPaletteInfo object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
ExportSettings object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Fill object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Frame object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
FrameNLayerIntersection object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Gradient object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
GradientNode object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Guides object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Last updated 5/17/2012
EXTENDING FIREWORKS
Contents
Layer object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
PathAttrs object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Pattern object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
RectanglePrimitive object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
RegisterMoveParms object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
SingleTextRun object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
SmartShape object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Style object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
TextAttrs object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
TextRuns object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Widget object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Chapter 6: HTML export objects
BehaviorInfo object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
BehaviorsList object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
exportDoc object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
ImageMap object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
ImagemapList object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
SliceInfo object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Slices object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
iv
Chapter 7: Cross-Product Extensions
Cross-product architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Flash panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Chapter 8: Auto Shapes
How Auto Shapes work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Creating an Auto Shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Chapter 9: Rich symbols
How Rich symbols work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
MXML Export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Chapter 10: Additional Fireworks Functions
Property inspector functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
History panel functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Static Document Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
Last updated 5/17/2012

Chapter 1: Extending Fireworks Overview

To extend Adobe® Fireworks® CS5, 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 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 Adobe® 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.
(www.adobe.com/go/exchange). By installing an existing extension,
Last updated 5/17/2012
EXTENDING FIREWORKS
Extending Fireworks Overview
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 CS5

Fireworks CS5 includes the following new features and interfaces that you can use to develop extensions for the product:
CSS-based layouts Fireworks CS5 now allows you to design complete web pages and export web standards-compliant
CSS-based layouts. You can select a layout and integrate foreground and background graphics with automatic margin and padding detection. You can drop HTML rich symbols on your Fireworks layouts to specify headings, links, and form properties for precise CSS control. You can also use rectangles with rounded corners and gradients for creating layouts.
Adobe Type Engine The new Adobe Type Engine provides enhanced typesetting capabilities similar to Adobe®
Photoshop® and Adobe® Illustrator®. You can import or copy/paste double-byte characters from Illustrator or Photoshop without loss of fidelity, and create advanced effects such as setting text inside a path.
2
Export to PDF You can generate high-fidelity, interactive, secure PDF documents from your Fireworks design comps
and receive review comments through a shared PDF review.
Smart Guides Use Smart Guides to expertly position and layouts objects on canvas. Use Smart Guides with tool tips
to achieve precise positioning.
Live Styles With Live Styles, you can use professionally designed styles or create your own collection. Enhanced
capabilities include redefining styles, dynamically updating effects, colors, and text attributes by updating the style source.
FXG export You can export designs as FXG files and use them in advanced design tools to develop rich Internet
applications and experiences that can run on Adobe® Flash Player or Adobe® AIR™.
Adobe AIR export You can package your Fireworks documents as Adobe AIR applications that you can secure using
a digital signature.
The following APIs have been added or modified for this release:
Last updated 5/17/2012
EXTENDING FIREWORKS
Extending Fireworks Overview
Class Property or Method Description
3
AIRExt AIRext.PreviewDocument() Calls the ADL tool to preview an HTML document as an Adobe AIR
AIRext.PackageApplication() Calls the ADT tool package an Adobe AIR application.
AIRext.CreatePackage() Calls the ADT tool to create a signed AIR package.
AIRext.CheckCertificatePasswor d()
AIRext.SaveDigSigPassword() Saves the password for the given digital certificate, for the current
AIRext.GetDigSigPassword() Returns the name of the generated password file.
AIRext.GetLastErrorLogName() Returns the name of the generated error log file if one was
AIRext.GetAIRInstallPath() Returns the full system path name and path of the generated file.
AIRext.GetJREVersion() An object with two properties - maxVersion and minVersion; if an
AIRext.CreateCertificate() Calls the ADT to create a self-signed digital certificate.
exportDoc isBackground Specifies whether the document has a background image. If an
backgroundAttachment Specifies whether the document is fixed or scrolls. Values are
docAlignment Specifies the page alignment as left, center, right. Default is left.
application.
Calls the ADT tool to check a certificate password.
session of Fireworks (no persistent storage).
created.
error occurs the values of the maxVersion and minVersion will be
-1.
image is set in the HTML set up, returns true.
Fixed or scroll.
backgroundURL Specifies the URL of the background image as file:///)
backgroundRepeat Specifies if the background image repeats, and if repeats in X, Y,
leftMargin Specifies the left margin of the page.
topMargin Specifies the top margin of the page.
rightMargin Specifies the right margin of the page.
bottomMargin Specifies the bottom margin of the page.
Repeat (Both) and No Repeat
Last updated 5/17/2012
EXTENDING FIREWORKS
Extending Fireworks Overview
Class Property or Method Description
4
SliceInfo backgroundHorizontalPosition Horizontal position of the background image. (Left, right, or
backgroundVerticalPosition Horizontal position of the background image. (Left, right, or
backgroundHorizontalPositionValHorizontal position value of the background image if the
backgroundVerticalPositionVal Vertical position value of the background image if the argument
isBackground Specifies whether the slice is background image or foreground
backgroundRepeat Specifies if the background image repeats, and if repeats in X, Y,
backgroundAttachment Specifies if the bg image is fixed or scrolls with the rest of the
RectPrimitive Mode Specifies the roundness units which can be relative (percentage)
instance tranform Specifies the transformation matrix of a symbol instance.
symbolName Specifies the symbol name.
frame name Species the name of the state.
FrameNLayerIntersection name Specifies the name of the layer when the layers are accessed from
center, numeric value)
center, numeric value)
argument is value.
is value.
image. True = Background.
Repeat (Both) and No Repeat.
page.
or exact (pixels).
states.
document dom.setRectRoundnessMode() Specifies the mode of corner roundness of the rectangle as either
dom.exportElements() Exports an array of elements on the canvas to a 32-bit PNG image,
dom.moveNineScaleGuide() Moves a 9-slice scaling guide’s position by specified pixels.
dom.placeTextInPath() Places the selected text inside the selected path. If no text and
dom.setSliceType() Sets the slice type as image (foreground image), background
dom.redefineStyleByName() Redefines the target style with the source style.
dom.snapToPixel() Snap To Pixel is applied on the selected object on the canvas.
dom.attachTextInPath() Attaches the selected text inside the selected path. If no text and
a percentage value or or exact pixel value.
based on the image export settings.
path are selected, no action occurs.
image, or empty (HTML Slice).
path are selected, no action occurs.
Last updated 5/17/2012
EXTENDING FIREWORKS
Extending Fireworks Overview
Class Property or Method Description
5
fw fw.saveAs() Saves the specified document in the specified filename and
fw.exportPDF() Exports the specified document to the specified file in PDF
fw.exportFXG() Exports current page, all pages of the open document in
fw.exportPages() Exports the specified pages in the specified format.
fw.shrinkPIWindow() Minimizes the Property inspector window.
fw.setUseAGMRenderingForSele ction()
fw.currentWorkspaceName() Returns the name of the current workspace layout.
fw.getFamilyNameForPSFont() Gets the family name of a PostScript font.
fw.getPlatformNameForPSFont() Returns the platform name of the PostScript font.
fw.saveDocumentAsTemplate(a
rg1,arg2)” on page 233
fw.saveDocumentAsTemplateA
sync(arg1,arg2)” on page 234
fw.newDocumentFromTemplat
e(arg1)” on page 224
fw.newMobileDocument(arg1,a
rg2,arg3,arg4)” on page 224
format.
format.
Fireworks, or selected objects from the current page as FXG files.
Sets the currently selected vectors to use the new AGM Rendering.
Saves the current document as a template.
Works the same as fw.saveDocumentAsTemplate() except for the async mode of save operation.
Opens up a file for selecting any template from the pre-defined Templates folder in Fireworks installation directory.
Creates a mobile document with the width, height, and resolution details.
fw.previewInDeviceCentral()” on page 227
fw.getDocumentDOM().InsertP
ageForImport” on page 214
fw.getDocumentDOM().combin
eCompoundShape” on page 213
fw.getDocumentDOM().createC
ompoundShape” on page 214
fw.appTemplatesDir (See “The
Fireworks Object” on page 191
fw.getDocumentDOM().Vector
Operation” on page 215
Files writeUTF8 Writes text in UTF8 encoding when the file is opened in UTF8
readLineUTF8 Reads one line from the file that has been opened with UTF8
Launches Adobe Device Central and previews the current document in it. If there is no active document, an alert message is generated.
Creates a compound shape from the selected vectors applying the operation that is specified. Requires two or more vectors to be selected.
Combines the compound shape that is selected. Requires selection of a compound shape.
Creates a compound shape from the selected vectors applying the operation that is specified. Requires two or more vectors to be selected.
Returns the path of the Templates directory present at the location where you have installed Fireworks.
Vector operation is applied on paths created after applying this API. A compound shape is created.
encoding.
encoding.
Last updated 5/17/2012
EXTENDING FIREWORKS
Extending Fireworks Overview

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:
You refers to the developer who is responsible for writing extensions.
The user refers to the person using Fireworks.
The visitor refers to the person who views the graphic that the user created.

Additional resources for extension writers

6
To communicate with other developers who are writing extensions, you can visit the Adobe online forums at
www.adobe.com/support/forums/.
Last updated 5/17/2012

Chapter 2: The Fireworks Object Model

If you want to extend the functionality of Adobe Fireworks CS5 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 “Core
objects” on page 17 and “The Document object” on page 28. (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 191).
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 objects” on page 277.
Objects within Fireworks documents” on page 243.
Global methods” on page 14.
7

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 “Property inspector functions” on page 321 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.
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 fw.getDocumentDOM().functionName() (for more
information, see
fw) to obtain the path to the Export Settings directory (appExportSettingsDir), which is
fw references the Fireworks global object, of which appExportSettingsDir
The Fireworks Object” on page 191), so a JavaScript command can assign the
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:
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
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
fw.getDocumentDOM().setDocumentResolution({pixelsPerUnit:72, units:"inch"}); fw.documents[0].resolution =72; fw.documents[0].resolutionUnits ="inch";
Accessing a Fireworks document” on page 7).
fw.getDocumentDOM() function references the current document (for more
8

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 7.
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 alphabetical 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, featherAmount:int, maskData:
maskBounds specifies the bounding rectangle of the mask area.
• Acceptable values for maskKind are "rectangle", "oval", "zlib compressed", "rle compressed", or
If the value of maskKind is "rectangle" or "oval", the maskData string is ignored, and a mask of the right shape is
If the value of maskKind is “zlib compressed“, “rle compressed", or “uncompressed", the maskData string is
hex-string}.
"uncompressed".
constructed that fills maskBounds and that has the edge specified by maskEdgeMode and featherAmount.
presumed to contain 8-bit mask data in hexadecimal format that precisely matches the maskBounds to define the mask.
"#rrggbbaa".
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
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 transformation 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“ or “cm“. For instance,
dom.setDocumentResolution(resolution) could look like the following example:
9
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().deleteLayer(2);
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 –

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
1 to indicate the current layer.

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.
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model

Palette or panel

Several API functions reference the History panel (see “History panel functions” on page 324). 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 supported in Fireworks and Dreamweaver to let developers easily create commands for both applications.

app.toggleFloater()

Identical to fw.toggleFloater().

app.setFloaterVisibility()

Identical to fw.setFloaterVisibility().
app.methodName().The following methods are currently
10

app.getRootDirectory()

Identical to the Fireworks object property appDir •.

app.browseDocument()

Identical to fw.browseDocument().
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 recognizable object is classified as one of the following element types:
Hotspot
SliceHotspot (basically, a slice)
Path
Group
Instance
Text
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
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.
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:
11
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
name
effects
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;
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model

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 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
To return the alt tag that has been applied to the currently selected Hotspot, type the following code:
altTag = fw.selection[0].altText;
Working with properties for any selected object” on page 11). These specific
12
SliceHotspot
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
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
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 return the instanceType for the currently selected instance, type the following code:
instance = fw.selection[0].instanceType;
Text
antiAliased
antiAliasMode
autoKern
orientation
pathAttributes
Note: For the complete list of pathAttributes properties, see “pathAttributes” on page 98.
13
randSeed
textRuns
textureOffset
transformMode
To return the antiAliasMode setting for the currently selected text block, type the following code:
antiAliasedSetting = fw.selection[0].antiAliasMode;
RectanglePrimitive
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;
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
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:
14
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.
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model

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)

15
Availability
Fireworks 3.
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)
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
Arguments
arg1, arg2, ..., argN Strings containing content for output.
Returns
An output file.
Description
Same as WRITE_HTML; WRITE_HTML was created to let you differentiate HTML output calls from other JavaScript calls in your code.

WRITE_CSS

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

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

Availability
Fireworks 3.
Usage
WRITE_HTML(arg1, arg2, ..., argN)
Arguments
arg1, arg2, ..., argN Strings 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 information,
HTML export objects” on page 277.
see
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model

fw.setUseAGMRenderingForSelection()

Availability
Fireworks 10.
Usage
fw. setUseAGMRenderingForSelection()
Arguments
A boolean value that defines whether AGMRendering is used or not.
Returns
Nothing.
Description
Sets the currently selected vectors to use the new AGM Rendering.
Example
fw.getDocumentDOM().setUseAGMRenderingForSelection(true);
17

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
Note: For information on how to format nonstandard data types, such as rectangle or point, see “Formatting
nonstandard data types” on page 8.

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.
The Document object” on page 28.
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
Method Data type Notes
18
copy(docname1, docname2)
createDirectory(dirname)
createFile(fileURL, fileType, fileCreator)
deleteFile(docOrDir)
deleteFileIfExisting (docOrDir)
enumFiles(docOrDir)
string, string Copies the file specified in the first argument to 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 overwrite a file if it already exists. Returns a value of
false otherwise.
true if the copy is successful;
string Creates the specified directory. Returns true if successful;
false otherwise.
string, string, string Creates the specified file. The file must not 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
fileType and fileCreator
strings should each be strings of exactly four characters in length, for example:
Files.createFile(newFile,".txt","FWMX");
string Deletes the specified file or directory. Returns true if
successful;
false if the file or directory does not exist or
cannot be deleted. Compare with
deleteFileIfExisting().
string Deletes the specified file or directory. Returns true if
successful; Unlike
false if the file or directory cannot be deleted.
deleteFile(), this method returns true if the file or
directory does not exist.
string Returns an array of file URLs. If docOrDir is a directory, the
array contains an entry 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).
exists(docOrDir)
getDirectory(docname)
getExtension(docname)
getFilename(docname)
getLanguageDirectory()
getLastErrorString()
string Returns true if docOrDir refers to a directory or file that
false otherwise.
exists;
string Returns only the directory name from docname, which is
expressed as file://URL. For example,
Files.getDirectory("file://work/logo.png")
"file:///work".
returns
string Returns the filename extension, if any, of docname. For
example, returns
Files.getExtension("birthday.png")
".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,
Files.getFilename("file:///work/logo.png")
"logo.png".
returns
string Returns the URL of the language directory associated 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.
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
Method Data type Notes
19
getTempFilePath ({dirname})
isDirectory(dirname)
makePathFromDirAndFile(dirna me, plainFilename)
open(docname, encoding, bWrite)
rename(docname, newPlainFilename)
string The argument, if used, must be expressed as file://URL. Returns
string The argument must be expressed as file://URL. Returns true if
string, string The first argument must be expressed as file://URL.
string, string, Boolean The first argument must be expressed as file://URL. Opens the
string, string The docname argument is a file path or a file URL to the file that
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 returned indicates a file in the specified directory rather than in the Temporary Files directory.
the specified URL refers to a directory that exists; otherwise.
Concatenates the two arguments to return a file URL that references the specified filename in the specified directory. For example,
Files.makePathFromDirAndFile("file:///work/rep orts", "logo.png") "file:///work/reports/logo.png".
specified file for reading or writing. The second argument specifies the encoding. If the third argument is opens for writing; otherwise it opens for reading. If the file cannot be opened, returns Reference object.
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 Fireworks returns
dirname is passed and is not null, the URL that is
false
returns
true, the file
null; otherwise, returns a File
null.
setFilename(docname, newPlainFilename)
swap(docname1, docname2)
string, string The first argument must be expressed as file://URL. Returns a
file URL with example,
Files.setFilename("file:///work/logo.png", "oldlogo.png") "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.
docname replaced by newPlainFilename. For
returns

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.
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
Method Data Type Notes
20
close()
readline()
readLineUTF8
write(textString)
writeUTF8(textString)
none Closes the current File Reference object. You are not required
none Reads the next line from the current File Reference object and
string Reads one line from the file that has been opened with UTF8
string Writes the specified string to the current File Reference object.
string Writes text in UTF8 encoding when the file is opened in UTF8
to use this method (the file is closed when the Files object is destroyed), but it is useful for controlling access to a file.
returns it as a string. The end-of-line character(s) are not included in the string. Returns if the line is longer than 2048 characters.
encoding.
No end-of-line characters are appended; to include one, use
"\n".
encoding.
null if end-of-file is reached or

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
whatToFind. These properties are listed in the following tables. Read-only properties are marked with a bullet (•).
Finding and replacing text
Property Data type Notes
whatToFind string In the format: "text"
find string Text to find.
matchCase Boolean If set to true, the search is case-sensitive. Defaults to false.
numItemsReplaced Integer Number of replacements done in a file using Find and Replace.
regExp Boolean If set to true, the find and replace text is interpreted as a
replace string Text to use as replacement text.
wholeWord Boolean If set to true, only whole words matching the search text are
regular expression. The default is
found. The default is
false.
false.
Finding and replacing fonts and styles
Property Data type Notes
whatToFind string In the format: "font"
find string Name of font to find.
replace string Name of font to use as replacement.
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
Property Data type Notes
findStyle 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 integer Number that represents the style to be used as replacement.
findMinSize integer 0 to 9999
findMaxSize integer 0 to 9999
replaceSize integer 0 to 9999, or pass -1 to leave size as is
21
Finding and replacing colors, fills, strokes, and effects
Property Data type Notes
whatToFind string In the format: "color"
find string A color string that specifies the color to find (for more
information, see
replace string A color string that specifies the color to use as a replacement
(for more information, see
fills Boolean If set to true, fills that match the specified colors are replaced.
strokes Boolean If set to true, strokes that match the specified colors are
Color string data type” on page 8).
Color string data type” on page 8).
replaced.
effects Boolean If set to true, effects that match the specified colors are
replaced.
Finding and replacing URLs
Property Data types Notes
whatToFind string In the format: "url"
find string URL to find, which is expressed as file://URL.
replace string URL to use as replacement text, which is expressed as file://URL.
wholeWord 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 interpreted as a
regular expression. The default value is
false.
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
Finding and replacing non-websafe colors with the closest websafe color
Property Data type Notes
whatToFind string In the format: "nonwebcolor"
22
effects Boolean If set to true, colors in effects are replaced. The default value is
fills Boolean If set to true, colors in fills are replaced. The default value is
strokes Boolean If set to true, colors in strokes are replaced. The default value
false.
false.
false.
is

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
osName string Returns the name of the operating system under which
controlFaceColor string Returns the system color used for the control and panel faces
controlHilightColor string Returns the system color used for control highlights (Windows-
controlShadowColor string Returns the system color used for control shadows (Windows-
controlDarkShadowColor string Returns the system color used for control dark shadows
Fireworks is running.
(Windows®-only property).
only property).
only property).
(Windows-only property).
hilightItemColor string Returns the system color used for highlighting selections
hilightTextColor string Returns the system color used for highlighting selected text
textColor string Returns the system color used for text (Windows-only
menuColor string Returns the system color used for menu backgrounds
menuTextColor string Returns the system color used for text in menus (Windows-only
(Windows-only property).
(Windows-only property).
property).
(Windows-only property).
property).

Adobe AIR Extension

AIRext.PreviewDocument()

Availability
Fireworks 10.
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
Usage
status= AIRext.PreviewDocument(appXMLPath, siteRootPath);
Arguments
appXMLPath Path to the application descriptor.
siteRootPath Path to the site root folder in which the file that need to be previewed reside.
Returns
0 if the operation succeeded.
Description
Calls the ADL tool to preview an HTML document as an Adobe AIR application. The path to file that needs to be previewed is not specified because it is included in the application descriptor; this path is relative to the site root.

AIRext.PackageApplication()

Availability
Fireworks 10.
23
Usage
status = AIRext.PackageApplication(siteFullPath, packagePath, fileList);
Arguments
siteFullPath Path to the site root folder in which all files that needs to be included in package reside.
packagePath Full path of the resulting Adobe AIR package.
fileList Array of paths to files and folders that need to be included in package; all paths need to be relative to the
site root.
Returns
0 if the operation succeeded; 1 if an error occurred; 2 if the ADT tool generated an error (this error is saved into an error log file).
Description
Calls the ADT tool package an Adobe AIR application.

AIRext.CreatePackage()

Availability
Fireworks 10.
Usage
status = AIRext.CreatePackage(siteFullPath, packagePath, fileList, appXMLPath, certificatePath, password);
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
Arguments
siteFullPath Path to the site root folder in which all files that needs to be included in package reside.
packagePath Full path of the resulting Adobe AIR package.
fileList Array of paths to files and folders that need to be included in package; all paths need to be relative to the
site root.
appXMLPath Path to the application descriptor (if blank or missing, defaults to application.xml in site root).
certificatePath Path to the digital certificate with which to sign the package (if blank or missing, an unsigned AIRI
file will be created instead of a signed AIR file)
password Password for the specified certificate (if blank or missing, user will be prompted for the password).
Returns
0 if the operation succeeded.
Description
Calls the ADT tool to create a signed AIR package.

AIRext.CheckCertificatePassword()

24
Availability
Fireworks 10.
Usage
status = AIRext.CheckCertificatePassword(certificatePath, password);
Arguments
certificatePath Path to the digital certificate with which to sign the package.
password Password for the specified certificate.
Returns
Exitcode from ADT; 0 if OK, 7 if could not access certificate, and so on.
Description
Calls the ADT tool to check a certificate password.

AIRext.SaveDigSigPassword()

Availability
Fireworks 10.
Usage
AIRext.SaveDigSigPassword(certificatePath, password);
Arguments
certificatePath Path to the digital certificate whose password is being saved.
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model
password Password for the specified certificate.
Returns
0 if saved successfully.
Description
Saves the password for the given digital certificate, for the current session of Fireworks (no persistent storage).

AIRext.GetDigSigPassword()

Availability
Fireworks 10.
Usage
configurationPath = AIRext.GetDigSigPassword();
Arguments
None.
25
Returns
The previously saved password for the given digital certificate, or an empty string.
Description
Returns the name of the generated password file.

AIRext.GetLastErrorLogName()

Availability
Fireworks 10.
Usage
errLogName = AIRext.GetLastErrorLogName();
Arguments
None.
Returns
The name of the error log file if it was created, or an empty string.
Description
Returns the name of the generated error log file if one was created.
Last updated 5/17/2012
EXTENDING FIREWORKS
The Fireworks Object Model

AIRext.GetAIRInstallPath()

Availability
Fireworks 10.
Usage
configurationPath = AIRext.GetAIRInstallPath();
Arguments
None.
Returns
The full system path to the current user configuration folder (for example, "C:\Documents and settings\...\Configuration").
Description
Returns the full system path name and path of the generated file.
26

AIRext.GetJREVersion()

Availability
Fireworks 10.
Usage
jreVersObj = AIRext.GetJREVersion();
Arguments
None.
Returns
An object with two properties - maxVersion and minVersion; if an error occurs the values of the maxVersion and minVersion will be -1.
Description
Get the minimum and maximum versions of the JRE.

AIRext.CreateCertificate()

Availability
Fireworks 10.
Usage
status = AIRext.CreateCertificate(certificatePath, password, keyType, publisher, orgName, orgUnit, country);
Last updated 5/17/2012
Loading...
+ 303 hidden pages