Extending Fireworks
Trademarks Afterburner, AppletAce, Attain, Attain Enterprise Learning System, Attain Essentials, Attain Objects for Dreamweaver, Authorware, Authorware Attain, Authorware Interactive Studio, Authorware Star, Authorware Synergy, Backstage, Backstage Designer, Backstage Desktop Studio, Backstage Enterprise Studio, Backstage Internet Studio, Contribute, Design in Motion, Director, Director Multimedia Studio, Doc Around the Clock, Dreamweaver, Dreamweaver Attain, Drumbeat, Drumbeat 2000, Extreme 3D, Fireworks,
CONTENTS CHAPTER 1: Extending Fireworks Overview . ............................. 5 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Installing an extension. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 What’s new in Extending Fireworks MX 2004 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Conventions used in this guide . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
CHAPTER 1 Extending Fireworks Overview To extend Macromedia Fireworks MX 2004, 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.
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 Macromedia Exchange website (www.macromedia.com/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 Macromedia Downloads website (www.macromedia.
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.
Chapter 1: Extending Fireworks Overview
CHAPTER 2 The Fireworks Object Model If you want to extend the functionality of Macromedia Fireworks MX 2004 by writing or modifying a JavaScript extensibility file, you must become familiar with the objects that Fireworks makes available through JavaScript.
Accessing a Fireworks document All the functions listed in “Document functions” on page 104 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: You can use methods that operate on a document’s DOM only on open documents.
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 an explanation of these objects, see “The Fireworks Object Model” on page 9. • Some functions accept a string in a specific format.
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: fw.getDocumentDOM().setDocumentResolution({pixelsPerUnit:72, units:"inch"}); Global methods The following table lists the global Fireworks methods, along with their argument data types and, where appropriate, acceptable values and notes.
Document object 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 “Document functions” on page 104. Property Data type Notes backgroundColor string A color string that specifies the document canvas color (see “Color string data type” on page 11).
Property Data type Notes frameLoopingCount integer –1 — don’t repeat 0 — repeat forever > 0 — repeat this number of times frames • array Array of Frame objects in the document (see “Frame object” on page 52). gammaPreview Boolean If set to true, the document should be previewed in opposite-platform gamma. If set to false, the document colors are unadjusted. gradients • array Array of Gradient objects that are available for use in the document (see “Gradient object” on page 53).
Property Data type Notes lastExportDirectory string The path to the last directory to which the file was exported, which is expressed as file:// URL, or null if the file was never exported. For instance, if the document was last exported to "file:///files/current/ logo.gif", it returns "file:///files/ current". lastExportFile string The name that was used the last time the file was exported, or null if the file was never exported.
Property Data type Notes resolution float Document resolution, in pixels per unit (see resolutionUnits). The range is 1 to 5000. resolutionUnits string The units to be used with the resolution property. Acceptable values are "inch" and "cm". textures • array Array of Texture objects that are available for use in the document (see “Texture object” on page 44). top integer Coordinate of the top edge of the document, in pixels. To find the bottom edge of the document, use document.top + document.
Here is an alphabetical list of the properties of the Errors object: EAppAlreadyRunning, EAppNotSerialized, EArrayIndexOutOfBounds, EBadFileContents, EBadJsVersion, EBadNesting, EBadParam, EBadParamType, EBadSelection, EBufferTooSmall, ECharConversionFailed, EDatabaseError, EDeletingLastMasterChild, EDiskFull, EDuplicateFileName, EFileIsReadOnly, EFileNotFound, EGenericErrorOccurred, EGroupDepth, EIllegalThreadAccess, EInternalError, ELowOnMem, ENoActiveDocument, ENoFilesSelected, ENoNestedMastersOrAliases,
Method Data type deleteFileIfExisting (docOrDir) string Notes Deletes the specified file or directory. Returns true if successful; false if the file or directory cannot be deleted. Unlike deleteFile(), this method returns true if the file or directory does not exist. enumFiles(docOrDir) 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.
Method Data type makePathFromDirAndFile(dirname, string, string plainFilename) Notes The first argument must be expressed as file:/ /URL. Concatenates the two arguments to return a file URL that references the specified filename in the specified directory. For example, Files.makePathFromDirAndFile("file:/// work/reports", "logo.png") returns "file:/ //work/reports/logo.png". open(docname, bWrite) string, Boolean The first argument must be expressed as file:/ /URL.
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.
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 (see “Color string data type” on page 11). replace string A color string that specifies the color to use as a replacement (see “Color string data type” on page 11). fills Boolean If set to true, fills that match the specified colors are replaced.
The Fireworks object The Fireworks object is a global object, which you can use to set or retrieve properties that relate to the current operating environment. (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 following table lists the properties of the Fireworks object, along with their data types and, where appropriate, acceptable values and notes. Read-only properties are marked with a bullet (•).
Property Data type Notes appName • string The name of the application ("Fireworks MX 2004"). This attribute is part of the common API, so it also appears as app.appName (as implemented in Macromedia Dreamweaver). appPatternsDir • string The path to the Patterns directory, which is expressed as file://URL. appPrefsDir string The path to the Preferences directory, which is expressed as a file://URL. appPresetsDir • string The path to the Presets directory, which is expressed as file://URL.
Property Data type Notes currentScriptDir string The path to the directory of the currently running script, which is expressed as a file:// URL (or could be null). This path goes to the directory in which the script resides, not a full file path to the script itself (it excludes the script’s filename). currentScriptFileName string The filename of the currently running script (or could be null). This name is the script’s filename, not the full path.
Property Data type Notes selection array Array of the selected objects in the active document. If nothing is selected, it returns an array of length zero. If no document is open, it returns null. selectedMask object If a single item is selected and that item is a mask, this property returns an ElementMask object (see “ElementMask object” on page 45); otherwise, it returns null. styles • array Array of the Style object that is currently loaded in the Style panel (see “Style object” on page 61).
Objects within Fireworks documents This section describes the objects that can get or set the properties of elements in a Fireworks document. For syntax on accessing Fireworks documents and elements within them, see “Accessing a Fireworks document” on page 10 and “Passing values” on page 10. Note: For information on how to format nonstandard data types, such as rectangle or point, see “Formatting nonstandard data types” on page 11.
Property Data type Notes diameter integer 0 to 1000 feedback string Acceptable values are "none", "brush", and "background". flowRate float 0 to 100 maxCount integer 0 to 64 minSize float 0 to 100 name string The name of the brush, which is visible in the Stroke panel.
Property Data type sense_random_size float sense_speed_angle float sense_speed_blackness float sense_speed_hue float sense_speed_lightness float sense_speed_opacity float sense_speed_saturation float sense_speed_scatter float sense_speed_size float sense_vdir_angle float sense_vdir_blackness float sense_vdir_hue float sense_vdir_lightness float sense_vdir_opacity float sense_vdir_saturation float sense_vdir_scatter float sense_vdir_size float sensitivity_x_y integer
Property Data type Notes tipSpacingMode string Acceptable values are "random", "diagonal", and "circular". type string Acceptable values are "natural" and "simple". Contour object The following table lists the properties of the Contour object, along with their data types and, where appropriate, acceptable values and notes. Property Data type Notes isClosed Boolean If set to true, the path is closed by connecting the final point in the contour with the first point.
Property Data type Notes succY float The y coordinate of the contour node’s following control point. x float The x coordinate of the contour node’s main control point. y float The y coordinate of the contour node’s main control point. The following table lists the methods of the ContourNode object, along with their parameters. Method Parameter Definition RegisterMove() object The RegisterMoveParms object containing the move parameters. Use smartShape.
ContourNodeDynamicInfo object The following table lists the properties of the ContourNodeDynamicInfo object, along with their data types and, where appropriate, acceptable values and notes. Property Data type Notes duration float 0.0 to 65,535.0 milliseconds pressure float 0.0 to 1.0 velocity float 0.0 to 255.
Method RegisterCircularMove() RegisterPolygonMove() RegisterInsertBBoxMove() Parameter Definition object The RegisterMoveParms object containing the move parameters. Use smartShape.GetDefaultMoveParms() to obtain this object, then adjust properties as needed. For a list of properties, see “RegisterMoveParms object” on page 56. point The center point for the circular movement. object The RegisterMoveParms object containing the move parameters. Use smartShape.
Property Data type Notes BevelType integer Sets a bevel as inner, outer, raised embossed, inset embossed, or glow effect, as follows: InnerBevel = 0 OuterBevel = 1 RaiseEmboss = 2 InsetEmboss = 3 GlowEffect = 4 BevelWidth integer The width of the bevel, in pixels.
Property Data type Notes MaskSoftness integer The feather amount on the glow edge, in pixels. OuterBevelColor string A color string that specifies the color of the outer bevel effect (see “Color string data type” on page 11). ShadowColor string A color string that specifies the color that is blended to provide the bevel shadow effect (see “Color string data type” on page 11). Currently black is always used for internally created effects (though any value should work).
Property Data type Notes EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true. EffectMoaID string "{3439b08c-1921-11d3-9bde00e02910d580}" Property Data type Notes EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true.
Find Edges object Property Data type Notes EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true. EffectMoaID string "{fc7093f1-f95c-11d0-8be200a024cdc039}" Property Data type Notes EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true. EffectMoaID string "{d04ef8c0-71b3-11d1-8c8200a024cdc039}" gaussian_blur_radius float 0.
Property Data type Notes ShadowDistance integer The offset of the shadow, in pixels. ShadowType integer 0 = normal shadow 1 = knockout shadow Property Data type Notes EffectMoaID string "{d2541291-70d6-11d1-8c8000a024cdc039}" EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true.
Property Data type Notes gamma_rgb float These gamma* values are all gamma levels to the filter, with values of 0.1 to 10.0.< Property Data type Notes EffectMoaID string "{c20952b1-fc76-11d0-8be700a024cdc039}" EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true.
Element object Element is an abstract or base class; nothing of class Element ever exists. However, it is useful for simplifying the other class descriptions. Read-only properties are marked with a bullet (•). Property Data type Notes blendMode string Acceptable values are "normal", "multiply", "screen", "darken", "lighten", "difference", "hue", "saturation", "color", "luminosity", "invert", "tint", and "erase". customData struct Assign any objects (array, integer, string, and so on).
The following table lists the methods of the Element object, along with their parameters. Method Parameter Definition generateSmartShapeCode root The root parameter is a string value that is prefixed to each line of output. Group object Group is a subclass of the base class Element and contains the following properties in addition to those in Element (see “Element object” on page 39). Property Data type Notes baseColors • array Array of color strings.
Method Parameter Definition RegisterForEvent() string Call this to receive notification of the string specifying a Fireworks event. smartShape.operation will be the name of the event triggered. Returns the total number of events registered after adding the specified event. removeTransformation() none Undoes the previous transformation. smartShapeToGlobalCoords() point Converts the smartshape object’s space into global (transformed) space, see globalToSmartShapeCoords() above..
Hotspot object A Hotspot converts to an image map during HTML export. Hotspot is a subclass of the base class Element and contains the following properties in addition to those in Element (see “Element object” on page 39). Property Data type Notes altText string Text that is written into the HTML Alt tag when exporting. behaviors array Array of Behavior objects for the Hotspot (see “Behavior object” on page 26). color string Color in which the Hotspot is drawn in the Document window.
Property Data type Notes sliceKind string If set to "image", generates an image; if set to "empty", generates the text specified by htmlText. tdTagText string This string contains all the attributes of a table cell except the colspan and rowspan values. An example value is "bgcolor=ff0000" valign="top". Path object Path is a subclass of the base class Element and contains the following properties in addition to those in Element (see “Element object” on page 39).
Property Data type Notes orientation string Acceptable values are "horizontal left to right" (the default), "vertical right to left", "horizontal right to left", and "vertical left to right". pathAttributes object PathAttrs object (see “PathAttrs object” on page 54). randSeed float A 32-bit integer. JavaScript integers hold only 31-bit numbers, so it is stored as a floating-point number. textRuns object TextRuns object (see “TextRuns object” on page 63).
ElementMask object The following table lists the properties of the ElementMask object, along with their data types and, where appropriate, acceptable values and notes. Property Data type Notes autoExpandImages Boolean If set to true, and the element mask is an image, the image is automatically expanded to fill the entire document, with areas “outside” the image showing through. If set to false (or if the element mask is not an image), areas “outside” the element mask are knocked out.
Property Data type Notes frameName string The name of the frame displayed in the Frames panel. Default is null. gifDisposalMethod string GIF89a frame disposal method. See the GIF89a specification for details. Acceptable values are "unspecified" (the default), "none", "background", and "previous". ExportOptions object Note: When this object is used to set properties, the only required property is exportFormat. If other properties are not specified, their default values are used.
Property Data type Notes colorMode string Acceptable values are "indexed" (the default), "24 bit", and "32 bit". crop Boolean The default value is false. cropBottom integer The default value is 0. cropLeft integer The default value is 0. cropRight integer The default value is 0. cropTop integer The default value is 0. ditherMode string Acceptable values are "none" (the default), "diffusion", and "2 by 2". ditherPercent integer 0 to 100; default value is 100.
Property Data type Notes paletteMode string Acceptable values are "adaptive" (the default), "custom", "grid", "monochrome", "Macintosh", "Windows", "exact", and "Web 216". paletteTransparencyType string Acceptable values are "none" (the default), "index", "index alpha", and "rgba". percentScale integer 1 to 100,000; default value is 100. progressiveJPEG Boolean The default value is false. savedAnimationRepeat integer The default value is 0.
ExportSettings object The following table lists the properties of the ExportSettings object, along with their data types and, where appropriate, acceptable values and notes. Property Data type Notes baseName string The name from which all automatically named slice names are derived. discardUnspecifiedSlices Boolean If set to true, omits undefined slices from export operations. docHtmlEncoding string Determines the encoding standard for the HTML file that Fireworks generates during export.
Property Data type Notes sliceAutoNaming1 through sliceAutoNaming6 string Used to generate a name by concatenating six strings. If you need fewer than six strings, fill in the remaining strings with "none". Acceptable values are: "none" — generates nothing. "row_col" — generates a unique row and column index; 0_0 is first, 0_1 is second, and so on. "ALPHA" — generates a unique uppercase letter: A is first, B is second, and so on.
Property Data type Notes sliceFrameNaming1 and sliceFrameNaming2 string Used to generate a name by concatenating two strings; the resulting string is concatenated to the name specified by sliceAutoNaming. If you need fewer than two strings, fill in the remaining string with "none". Acceptable values are: "none" — generates nothing. "frameNumber" — generates frame number preceded by f, for example, f2. "number" — generates frame number, for example, 2.
Property Data type Notes shape string Acceptable values are "solid", "linear", "radial", "conical", "satin", "pinch", "folds", "elliptical", "rectangular", "bars", "ripple", "waves", "pattern", and "web dither". stampingMode string Acceptable values are "blend" and "blend opaque". textureBlend float 0 to 100 webDitherTransparent Boolean If set to true (and shape is set to "web dither"), then the second color in the ditherColors array is ignored and transparent is used instead.
Gradient object The following table lists the properties of the Gradient object, along with their data types and, where appropriate, acceptable values and notes. Property Data type Notes name string The name that appears in the Fill panel. nodes array Array of GradientNode objects (see “GradientNode object” on page 53). opacityNodes array Array of GradientNode objects (see “GradientNode object” on page 53), that identify the opacity ramp associated with a gradient.
Layer object The following table lists the properties of the Layer object, along with their data types and, where appropriate, acceptable values and notes. Read-only properties are marked with a bullet (•). Property Data type Notes disclosure Boolean If set to true, the Layers list displays all the objects in the layer. If set to false, only the name of the layer appears. frames • array An array of FrameNLayerIntersection objects (see “FrameNLayerIntersection object” on page 52).
Pattern object The following table lists the property of the Pattern object, along with its data type and notes. Property Data type Notes name string The name that appears in the Fill panel. RectanglePrimitive object The following table lists the properties and methods of the RectanglePrimitive object, along with their data types and, where appropriate, acceptable values and notes.
RegisterMoveParms object The following table lists the properties of the RegisterMoveParms object, along with their data types and, where appropriate, acceptable values and notes. 56 Property Data type Notes constrainAngles Boolean Determines whether dragging the control point constrains the angles to the minAngle and maxAngle values. constrainRotateKey string Pass in the key that you want to use to constrain the rotation. A value of "none" means that rotation will not be constrained.
Property Data type Notes constrain45Key string The key value that you want to use to constrain movement to the nearest 45º increment. Can be one of the following: "none", "shiftKey", "ctrlCmdKey", "altOptKey". A key value of "none" means dragging will not be constrained, "shiftKey" (or other value) means that when the user holds downs Shift key (or other value) while dragging, movement will be constrained.
Property Data type Notes deltaXtoX float The ratio of mouse movement to the movement of the referenced point’s x coordinate. For example, 1.0 means that when the mouse moves 1 pixel to the right, the referenced point also moves 1 pixel to the right. deltaXtoY float The ratio of mouse movement on the x-axis to the movement of the referenced point’s y coordinate. For example, 1.
Property Data type Notes maxX float The maximum value the x coordinate can move. maxY float The maximum value the y coordinate can move. minAngle point The minimum angle that can be set. minLinear float The minimum amount the point can move along a line . minMaxRelative Boolean Determines whether the min and max values are relative or absolute. For example, if max.x=100 and minMaxRelative is true, then x can move up 100 points to the right.
SmartShape object The following table lists the properties of the SmartShape object, along with their data types and, where appropriate, acceptable values and notes. 60 Property Data type Notes altOptKeyDown • Boolean Indicates whether the Alt/Option key is pressed (true if pressed, otherwise false). constrainDragInsertAspect Boolean Determines if, while dragging a shape on the canvas, the aspect ratio is constrained (true if constrained, otherwise false).
The following table lists the method of the SmartShape object, along with its parameter. Method Parameter Definition GetDefaultMoveParms() object Returns an object that has all of the default move parameters set. Style object The following table lists the properties of the Style object, along with their data types and, where appropriate, acceptable values and notes. All Style object properties are read-only.
Property (read-only) Data type Notes use_fill Boolean If set to true, applies the fill property of the pathAttrs object when applying the style. If set to false, ignores the fill property. The default value is false. use_fillColor Boolean If set to true, applies the fillColor property of the pathAttrs object when applying the style. If set to false, ignores the fillColor property. The default value is false.
Property Data type Notes kerning float Also known as pair kerning, kerning specifies the percentage of an em square by which to separate two characters, in addition to the amount the font specifies. Applies to only one pair or characters. To specify kerning for a range of text, use the rangeKerning property.
HTML export objects Fireworks provides several object types that support the output of HTML and sliced images from Fireworks. These objects let you write JavaScript scripts that create templates to output the type of HTML that suits your specific requirement (generic HTML, Dreamweaver-compatible HTML, and so on). For each HTML template, use a Slices.htt file that generates the HTML for that particular template. For more information, see the Slices.htt and Metafile.
Property (read-only) Data type Notes hasTargetFrame Boolean For swap image behaviors, true if the swap image swaps in another frame in the Fireworks file. The value of hasTargetFrame is always the opposite of hasHref; you cannot swap from two sources. horzOffset integer If action is set to 9 (Popup Menu), horzOffset specifies the horizontal pixel offset for the menu. href string A link, which is expressed as file://URL. For swap-image behaviors, it’s the file URL for an external swap image file.
exportDoc object The following table lists the properties of the exportDoc object, along with their data types and, where appropriate, acceptable values and notes. All exportDoc properties are read-only. Note: This object type does not start with a capital letter. 66 Property (read-only) Data type Notes altText string The alternate text description for the Fireworks document.
Property (read-only) Data type Notes generateHeader Boolean Set to true if an HTML file is generated; false if the output goes to the Clipboard. hasAltText Boolean Set to true if the Fireworks document has an alternate text description. hasBackgroundLink Boolean Set to true if the Fireworks document has a background URL. height integer Height of the image that is being exported, in pixels. In the Slices.htt file, it is the total height of the output images.
Property (read-only) Data type Notes tableAlignment string A string that contains the alignment of the table. If the table is left-aligned, the string is simply a space (this is used for writing the HTML table). If the table is center-aligned, the string is "align="center"". If the table is right-aligned, the string is "align="right"". width integer Width of the image being exported, in pixels. In the Slices.htt file, it is the total width of the output images.
Property (read-only) or Method Data type xCoord(index) Notes zero-based index Returns the x coordinate for the specified point, in pixels. For example, the following commands return the coordinates for the first point: var x = imagemap.xCoord(0); var y = imagemap.yCoord(0); It is possible to have negative values if the image map area is drawn so that it crosses the left or top sides of the image (or sliced image).
Property (read-only) or method Data type 70 Notes getFrameFileName (frameIndex) zero-based index Returns a string that is the filename for the slice on the specified frame, without directory or extension information. For example, when exporting a file base named Button, Slices[0][0].getFrameFileName(0) returns "Button_r1_c1". Generally all slices that have images have a frame filename. For frames 1 and higher, only slices that are rollovers or that are targeted by a swap image have names.
Property (read-only) or method Data type Notes setFrameFileName (frameIndex) zero-based index Sets the filename for the slice on the specified frame, without directory or extension information. You can stop an image from being exported by setting its name to "" (an empty string). skipCell Boolean Set to true if this cell in the table is covered by a previous row span or column span. tableAlign string The table alignment for the table in the current cell.
The following table lists the properties of the Slices object, along with their data types and, where appropriate, acceptable values and notes. All Slices object properties are read-only. Property (read-only) Data type Notes demoIndex zero-based index Index for each file generated for multiple file button export. doDemoHTML Boolean Corresponds to the Export Multiple Nav bar HTML Files check box in the Document Specific tab of the HTML Setup dialog box.
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 specific properties for selected elements Some elements have specific properties that can be returned and set in addition to those that can be set for selected objects (see “Working with properties for any selected object” on page 73). These specific properties are available for each of the following elements when the elements are selected.
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 return the instanceType for the currently selected instance, type the following code: instance = fw.selection[0].
RectanglePrimitive • • Roundness pathAttributes Note: For the complete list of path attributes properties, see “pathAttributes” on page 76. • • originalSides transform To return the roundness setting for the currently selected rectangle, type the following code: roundness = fw.selection[0].roundness; pathAttributes Several objects have the pathAttributes property.
CHAPTER 3 Cross-Product Extensions Cross-product extensions include any Fireworks-related extensions developed for, or in, another Macromedia application. These cross-product extensions include those written for other tools, such as Macromedia Dreamweaver MX 2004 that leverage existing Fireworks MX 2004 functionality.
Fireworks RPC transactions pass XML between an RPC client and the Fireworks RPC server built into Fireworks MX 2004. The RPC client is any supported program that connects to Fireworks through a TCP stream on port 12124. The Fireworks RPC server is the internal code that listens on TCP port 12124 and then handles client requests.
The RPC client sends four types of requests, specified in the XML tag name of the envelope: • get The get operation retrieves the current object properties. The get operation can contain only the obj and name attributes and no subelements. In this example, the client requests the value of the appDir property of the object whose ID is 1: • set The set operation sets the object properties.
Fireworks has four reserved object IDs: • "0" This is the Invalid Object ID, used for nonexistent or invalid objects. It is not frequently used for the RPC client, but it is used in several places for the RPC server. • "fw" This is the Fireworks Application Object ID. The Fireworks Application Object ID references the main application object in Fireworks and is of the Fireworks class. This object is used to open and create documents. In JavaScript, it is the object referenced by App or fw.
Data type Node name Example Description dictionary dict A dictionary data type. Like the array data type, it is simply a container for other data nodes. Each direct child node of a dictionary node must contain an additional key attribute. The key attribute is a string and must be unique for the given dictionary node.
Parameters Parameters are simply data nodes with an order attribute. The order attribute identifies the order in which the parameters should be processed for the server. In this way, the RPC client can use any XML client library to build parameters in any order, and the RPC server retains the correct parameter order.
Error code Description 4 No such property. The property that the client requested does not exist on the specified object. 5 Read-only property. The set request cannot be completed because the specified property is read only. 6 Wrong number of parameters. The request did not specify the correct number of parameters. Either more or fewer parameters are needed. 7 Wrong parameter type. One or more of the parameters given is of the wrong type.
DOM data type RPC data type Example Description date dictionary A date is a dictionary with the following subelement keys: year, month, day, hour, minutes, and seconds. All six elements are integer data types. dictionary dictionary Types map identically. float float PAGE 85DOM data type RPC data type Example Description resolution dictionary A resolution is a dictionary with two subelement keys: units and pixelsPerUnit. The units key can be any of these strings: inch, cm, or pixels.The pixelsPerUnit key is a float data type. string string Types map identically. URL string
RPCMethods.CreateAutoReleasePool() Usage RPCMethods.CreateAutoReleasePool() Arguments None. Returns Nothing. Description Starts the auto-release block. RPCMethods.DestroyAutoReleasePool() Usage RPCMethods.DestroyAutoReleasePool() Arguments None. Returns Nothing. Description Ends the auto-release block and frees all allocated remote objects in the current auto-release block function. RPCMethods.AddToAutoReleasePool() Usage RPCMethods.
RPCMethods.RemoveFromAutoReleasePool() Usage RPCMethods.RemoveFromAutoReleasePool(proxyObject) Arguments proxyObject The object to remove from the current pool. Returns Nothing. Description Removes an object from the current auto-release pool so that it can be used in another code block. RPCMethods.ReleaseObject() Usage RPCMethods.ReleaseObject(Object) Arguments Object The name of the object to release from memory. Returns Nothing. Description Releases an object from memory.
Accessing proxy objects If you want to access a proxy object outside of an auto-release block, you must use the RemoveFromAutoReleasePool() function. The RemoveFromAutoReleasePool() function manually removes an object reference from the auto-release pool before exiting the auto-release block. In this example, the reference to the object defined as selObject is removed: RPCMethods.CreateAutoReleasePool(); var selObject = fw.selection.get(0); RPCMethods.RemoveFromAutoReleasePool(selObject); RPCMethods.
//Create new doc var fwdoc = fw.createFireworksDocument(size, res, "#0033FF"); //Define a rectangle object the short way var rect = {left:10, top:10, right:210, bottom:210}; //Add Rectangle fwdoc.addNewRectanglePrimitive(rect,0.20); //Set its color fwdoc.setFillColor("#00CC99"); RPCMethods.DestroyAutoReleasePool(); } RPCMethods.DestroyAutoReleasePool(); 7 Publish the SWF file. When you publish the SWF file, make sure the stubs files are in the same directory as your FLA file.
Flash panels Fireworks contains Macromedia Flash Player, which plays Shockwave files as panels and commands in the Fireworks interface. You can also add a Macromedia API wrapper extension to Macromedia Flash for creating Shockwave files that communicate with the Fireworks API.
Description Declares a set of JavaScript code to pass to the Fireworks API, allowing Flash authors to embed Fireworks API commands in a frame of a Flash movie. Note: MMExecute supersedes the FWJavascript command. However, the FWJavascript command still works in the current version of Fireworks. The commands should be embedded in the same way that you would write separate JavaScript code blocks to perform similar operations, and you can concatenate lines of JavaScript code into one MMExecute() function.
To install the API wrapper, make sure you have the Macromedia Extension Manager installed and double-click the Extension file. In Macromedia Flash, the wrapper appears in the Components window as FWCommandComponents. The following example shows a command without the wrapper: var path = MMExecute("fw.appPatternsDir;"); The following example shows the same command using the wrapper: var path =fwapi.
Creating event handlers To create an event handler, implement a function with the corresponding event name. Currently, Fireworks supports the following events for Flash panels: Event Description onFwStartMovie Sent to the SWF file right after Fireworks has started (or restarted) the SWF file. onFwStopMovie Sent to the SWF file right before Fireworks stops the file (and possibly unloads it). onFwUnitsChange Sent when the user changes the type of units (inches, pixels, centimeters) in the Info panel.
Example function onFwDocumentNameChange() { // your code goes here } Example _global.onFwDocumentNameChange = function () { // your code goes here } Both examples show how to implement a handler for the document name changed event. However, the second example will only work if the assignment executes before or during the onFwStartMovie handler. Publishing When testing your script, use the File > Publish menu option in Macromedia Flash MX.
CHAPTER 4 Auto Shapes Auto Shapes are vector objects that contain information about how the user can interact with them onscreen. Auto Shapes appear in the Macromedia Fireworks MX 2004 user interface as “Auto Shapes” but are programmatically called “smartShape” objects in the JavaScript code that constructs them. For example, a spiral shape consists of relationships among several smaller objects.
Creating an Auto Shape To create an Auto Shape, you need to define a series of properties for the shape, define the shape’s control points, and write functions that tell Fireworks how to handle the Auto Shape as the user interacts with the object (see “Handling the user interaction” on page 97). Defining the shape The following code creates the initial shape, a rectangle (a more concise way of creating an initial shape follows this example): function InsertSmartShapeAt() { smartShape.elem.
// Set the new point's values node.x = node.predX = node.succX = x; node.y = node.predY = node.succY = y; } You can then simplify the InsertSmartShapeAt() function with the new helper function: function InsertSmartShapeAt() { var elem = smartShape.elem; var newPath = new Path; elem.elements[0] = newPath; newPath.contours[0] = new Contour; var contour = newPath.
Fireworks messages Fireworks passes the following messages to the SmartShape object as the user interacts with (inserts, moves, or changes) the shape: • "InsertSmartShapeAt" Fireworks sends this message when the user selects the shape from the Tools panel and clicks on the canvas, or drags the shape from the Auto Shapes panel to the canvas. • "BeginDragInsert" Fireworks sends this message when the user drags an Auto Shape onto the canvas.
The following table lists all of the available Fireworks message handler functions you can create (although, you don’t have to write a response to every Fireworks message, only the ones important to your Auto Shape): Function Description InsertSmartShapeAt() Draws the initial shape. This function is called when the user selects the shape from the Tools panel and clicks on the canvas, or drags the shape from the Auto Shapes panel to the canvas.
These functions correspond directly with the messages listed in “Fireworks messages” on page 98. To invoke your own function names in response to Fireworks messages, you need to write a switch() statement. Switch Statements If you take a look at some existing Auto Shapes (in the Configuration/Auto Shapes folder and in the Configuration/Auto Shape Tools folders), you’ll notice a switch() statement near the beginning of the file.
Supporting functions and methods Since the Auto Shape file is written in JavaScript, your functions can use global variables, common functions, and the Fireworks JavaScript API. The Auto Shape JavaScript file contains the definition of the shape’s points, and a series of functions to handle the Fireworks messages as the user interacts with the shape. The file also includes a series of commands and functions defining the shape’s properties and other functionality.
Chapter 4: Auto Shapes
CHAPTER 5 Fireworks JavaScript API This chapter lists JavaScript functions supported by Macromedia Fireworks MX 2004 that enable you to create useful Fireworks extensions and customized Fireworks menus. Almost any task that the user can accomplish in Fireworks with the menus, tools, or floating panels can be done programmatically using JavaScript.
Palette or panel Several API functions reference the History panel (see “History panel functions” on page 278). 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.
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); 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 104.
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 internally by Fireworks. • swapFrame is an integer value that specifies use fileName as a URL, pass –1 here). • fileName specifies the frame or file to be swapped.
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. 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().
Example fw.getDocumentDOM().addBehavior("MM_statusMessage(\"Status Message!\")", "onMouseOver", -1); MM_swapImage Availability Fireworks 3. Arguments target, swapFrame, fileName, preload, restoreOnMouseOut • • • • • specifies the slice to which the behavior is attached. Pass –1 for this value; all other values are used internally 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).
dom.addElementMask() Availability Fireworks 4. Usage dom.addElementMask(mode, {bEnterMaskEditMode} Arguments mode Acceptable values for mode are "reveal all", "hide all", "reveal selection", and "hide selection". If the user is not in bitmap mode, or if there is no pixel selection, "reveal selection" and "hide selection" operate the same as "reveal all" and "hide all", respectively.
Example The following command adds one frame after the current frame but does not change the active frame. fw.getDocumentDOM().addFrames(1, "after current", false); dom.addGuide() Availability Fireworks 3. Usage dom.addGuide(float position, guidekind) Arguments position A floating-point value that specifies the x or y coordinate at which to add the guide. guidekind Acceptable values for guidekind are "horizontal" and "vertical".
Description Adds a new Hotspot that fits into the specified bounding rectangle. Example The following command adds a new rectangle slice with the specified coordinates. fw.getDocumentDOM().addNewHotspot("slice","rectangle",{left:0, top:0, right:50, bottom:100}); dom.addNewImage() Availability Fireworks 3. Usage dom.AddNewImage(boundRectangle, bEnterPaintMode) Arguments A rectangle that specifies the bounds of the image to be added (see “Rectangle data type” on page 11).
Description Adds a new image to the document containing the contents of the current paint-mode selection. The new image is placed directly above the active bitmap. You must have a current pixel selection for this to succeed. The new bitmap appears with Fireworks in paint mode. dom.addNewImageViaCut() Availability Fireworks MX. Usage dom.addNewImageViaCut() Arguments None. Returns Nothing. Description Adds a new image to the document that contains the contents of the current paint mode selection.
dom.addNewLine() Availability Fireworks 3. Usage dom.addNewLine(startPoint, endPoint) Arguments Points that specify the x,y coordinates between which the path is added (see “Point data type” on page 11). startPoint and endPoint Returns Nothing. Description Adds a new path between two points. The new path uses the document’s current default path attributes and is added to the current frame and layer. Example The following command adds a new line between the specified coordinates. fw.getDocumentDOM().
dom.addNewRectangle() Availability Fireworks 3. Usage dom.addNewRectangle(boundingRectangle, roundness) Arguments A rectangle that specifies the bounds within which the new rectangle is added (see “Rectangle data type” on page 11). boundingRectangle roundness A floating-point value between 0 and 1 that specifies the “roundness” to use for the corners (0 is no roundness, 1 is 100% roundness). Returns Nothing. Description Adds a new rectangle or rounded rectangle fitting into the specified bounds.
Description Adds a new rectangle primitive that fits in the specified bounds. The rectangle primitive uses the document’s current default path attributes, is added on the current frame and layer, and has several editable properties, such as corner roundness and transformation.
dom.addNewStar() Availability Fireworks 3 Usage dom.AddNewStar(numSides, spikiness, bIsStar, centerPoint, outsidePoint) Arguments numSides An integer that specifies the number of sides of the new path. A floating-point value that controls the regularity of the star or polygon. Pass -1 to have Fireworks calculate a good value, or pass a value between 0 and 1 for manual control. spikiness If bIsStar is true, a star with the specified number of points is created.
Description Adds a new symbol to the library and opens the symbol document for editing. Optionally adds an instance of the symbol to the document. Example The following command adds a new graphic symbol called text to the library and places an instance of it in the document. fw.getDocumentDOM().addNewSymbol("graphic", "text", true); dom.addNewText() Availability Fireworks 3. Usage dom.
Returns true if the swap image behavior was added; false if no suitable Hotspot was at the specified location. Description If a single Hotspot or slice is selected, this function adds to it a swap image behavior from the Hotspot or slice located at where in the document. dom.adjustExportToSize() Availability Fireworks 3. Usage dom.AdjustExportToSize(sizeInBytes, bOkToIncreaseSize) Arguments An integer that specifies the size to be used for exporting.
Description Increases (positive values) or decreases (negative values) the font size of selected text elements. If a text element has multiple font sizes, each size is adjusted independently. dom.align() Availability Fireworks 3. Usage dom.align(alignmode) Arguments alignmode Acceptable values and "center horizontal". are "left", "right", "top", "bottom", "center vertical", Returns Nothing. Description Aligns the selection. dom.appendPointToHotspot() Availability Fireworks 3. Usage dom.
dom.appendPointToPath() Availability Fireworks 3. Usage dom.appendPointtoPath(ontourIndex, ptToInsertBefore, controlPointFirst, mainPoint, controlPointLast) Arguments contourIndex An zero-based index value that specifies the contour to which the Bézier point is appended. For paths with multiple contours, the contours are in an arbitrary order. ptToInsertBefore A zero-based index value that specifies where on the path the new point should be placed.
Description Appends a point to the selected unclosed polygon slice. If an unclosed polygon slice is not selected, then a new polygon slice is created with the single point that passed in. dom.applyCharacterMarkup() Availability Fireworks 3, enhanced in 4. Usage dom.applyCharacterMarkup(tag) Arguments tag Acceptable values for tag are "b", "i", and "u", for bold, italic, and underline: "fwplain", which was added in Fireworks 4, for text with no character markup. and Returns Nothing.
dom.applyEffects() Availability Fireworks 3. Usage dom.ApplyEffects(effectList) Arguments An EffectList object (see “EffectList object” on page 38). If effectList is null, this function removes all effects from the selection. effectList Returns Nothing. Description Applies the specified effects to the selection. Example The following command applies a drop shadow with an angle of 315, a blur of 4, a color of black, and a distance of 7 (see “Drop Shadow object” on page 35). fw.getDocumentDOM().
dom.applyStyle() Availability Fireworks 3. Usage dom.applyStyle(styleName, styleIndex) Arguments styleName A string that specifies the style name to be applied. An index to the style to apply. This is usually zero. However, if there are multiple styles with the same name, styleIndex is used to resolve the ambiguity (0 references the first style with that name, 1 references the second, and so on). styleIndex Returns Nothing. Description Applies the specified style to the selection.
dom.attachTextToPath() Availability Fireworks 3. Usage dom.attachtTextToPath() Arguments None. Returns Nothing. Description Attaches the selected text to the selected path. If no text and path are selected, no action occurs. Example When two items are selected (one a text block and the other a shape), the following command attaches the text block to the shape’s path. fw.getDocumentDOM().attachTextToPath(); dom.changeGuide() Availability Fireworks 3. Usage dom.
dom.changeSliceGuide() Availability Fireworks MX. Usage dom.changeSliceGuide(currentPosition, newPosition, guidekind, isMagneticDrag) Arguments currentPosition A floating-point value that specifies the current position of the slice guide to be moved. newPosition A floating-point value that specifies the new position of the slice guide. guidekind Acceptable values are "horizontal" and "vertical".
Returns Nothing. Description Clears the “Selective JPEG mask” for the document. dom.clipCopy() Availability Fireworks 3. Usage dom.clipCopy() Arguments None. Returns Nothing. Description Copies the selection to the Clipboard. Example The following command copies the selected items to the Clipboard. fw.getDocumentDOM().clipCopy(); dom.clipCopyAsPaths() Availability Fireworks MX. Usage dom.clipCopyAsPaths() Arguments None. Returns Nothing.
dom.clipCopyFormats() Availability Fireworks MX. Usage dom.clipCopyFormats(format) Arguments format The graphics format for the selection. For example, "AICB" is the Adobe Illustrator format. Returns Nothing. Description Copies the selection to the Clipboard using the specified format. dom.clipCut() Availability Fireworks 3. Usage dom.clipCut() Arguments None. Returns Nothing. Description Cuts the selection to the Clipboard.
Arguments whatIfResolutionDifferent An optional string that specifies how resampling should be done if the resolution of the Clipboard contents doesn’t match the resolution of the document. Acceptable values for whatIfResolutionDifferent are "resample", "do not resample", and "ask user" (displays a dialog box to let the user decide). If whatIfResolutionDifferent is omitted or null, "ask user" is assumed.
Returns Nothing. Description Pastes the Clipboard contents into the document as an element mask. Only one element can be selected when calling this function. If more than one element (or none) is selected when this function is called, Fireworks throws an exception. An exception is also thrown if there is nothing on the Clipboard. dom.clipPasteAttributes() Availability Fireworks 3. Usage dom.clipPasteAttributes() Arguments None. Returns Nothing.
Description Pastes the specified color channel on the Clipboard into each of the RGB channels of a new image or into the specified channel of the selected image, if any. Example The following command copies the red data from the Clipboard into the red channel: fw.getDocumentDOM().clipPasteFromChannelToChannel("red", "red"); The following command copies the green data from the clipboard into the alpha channel: fw.getDocumentDOM().clipPasteFromChannelToChannel("green", "alpha"); dom.
dom.cloneSelection() Availability Fireworks 3. Usage dom.cloneSelection() Arguments None. Returns Nothing. Description Makes exact duplicates of the selection, placing the duplicated items directly on top of the original items. Example The following command copies the selected items on top of the original items. fw.getDocumentDOM().cloneSelection(); See also dom.duplicateSelection() dom.close() Availability Fireworks 3. Usage dom.
dom.convertAnimSymbolToGraphicSymbol() Availability Fireworks 4. Usage dom.converAnimSymbolToGraphicSymbol() Arguments None. Returns Nothing. Description If a single animation symbol is selected, this function converts it from an animation symbol to a graphics symbol. See also dom.convertToAnimSymbol(), dom.convertToSymbol() dom.convertToAnimSymbol() Availability Fireworks 4. Usage dom.
Description Converts the selected item(s) to a new animation symbol. See also dom.convertAnimSymbolToGraphicSymbol(), dom.convertToSymbol(), dom.setAnimInstanceNumFrames() dom.convertToPaths() Availability Fireworks 3. Usage dom.convertToPaths() Arguments None. Returns Nothing. Description Converts the selected text items into editable paths. Example The following command converts the selected text items into editable paths. fw.getDocumentDOM().convertToPaths(); dom.
Example The following command creates a graphic symbol from the selected item and names it “star”. fw.getDocumentDOM().convertToSymbol("graphic", "star"); See also dom.convertToAnimSymbol(), dom.convertAnimSymbolToGraphicSymbol() dom.convolveSelection() Availability Fireworks MX 2004. Usage dom.convolveSelection( kernelWidth, kernelHeight, kernelValues, affectsAlpha) Arguments kernelWidth An integer that defines the width of the filter coefficients.
Arguments None. Returns Nothing. Description Opens the Copy HTML Wizard dialog box. Example The following command opens the Copy HTML Wizard dialog box: fw.getDocumentDOM().copyHtmlWizard(); dom.copyToHotspot() Availability Fireworks 3. Usage dom.copyToHotspot(hotspotType, {whatIfMultipleSelected}) Arguments hotspotType Acceptable values are "hotspot" and "slice". whatIfMultipleSelected An optional string that specifies how to create Hotspots if multiple items are selected.
Arguments boundingRectangle A rectangle that specifies the bounds within which the selection should be cropped (see “Rectangle data type” on page 11). Returns Nothing. Description Crops the selection to the specified rectangle. dom.deleteAllInDocument() Availability Fireworks MX. Usage dom.deleteAllInDocument() Arguments None. Returns Nothing. Description Deletes all the objects in the document. dom.deleteFrames() Availability Fireworks 3. Usage dom.
dom.deleteLayer() Availability Fireworks 3. Usage dom.deleteLayer(layerIndex) Arguments An integer value that specifies the the layer to be deleted, starting with 0 (although, to specify the current layer, pass –1 here). layerIndex Returns Nothing. Description Deletes a layer. Example The following command deletes the current layer. fw.getDocumentDOM().deleteLayer(-1); dom.deletePointOnPath() Availability Fireworks 4. Usage dom.
dom.deleteSelection() Availability Fireworks 3. Usage dom.deleteSelection(bFillDeletedArea) Arguments This argument is ignored if Fireworks is not in bitmap mode. If Fireworks is in bitmap mode and bFillDeletedArea is true, the deleted pixels are filled with the current fill color. If false, the deleted pixels are filled to transparent. bFillDeletedArea Returns Nothing. Description Deletes the selection, or the pixel selection if Fireworks is in bitmap mode.
Example The following command deletes the selected symbols from the library as well as any active instances from the document. fw.getDocumentDOM().deleteSymbol(null); dom.detachInstanceFromSymbol() Availability Fireworks 3. Usage dom.detachInstanceFromSymbol() Arguments None. Description Breaks the links between the selected instances and the owning symbols. Returns Nothing. dom.detachTextFromPath() Availability Fireworks 3. Usage dom.detachTextFromPath() Arguments None. Returns Nothing.
Returns Nothing. Description Distributes the selection along a vertical or horizontal dimension. dom.distributeLayerToFrames() Availability Fireworks 3. Usage dom.distributeLayerToFrames(layerIndex) Arguments An integer value that specifies the layer that contains the items to be distributed, starting with 0 (although, to specify the current layer, pass –1 here). layerIndex Returns Nothing.
dom.dragControlPoint() Availability Fireworks MX 2004. Usage dom.dragControlPoint(index, newLoc, shiftKeyDown, ctrlCmdKeyDown, altOptKeyDown) Arguments The index of the control point to move. index Specifies the new location of the point. newLoc shiftKeyDown Specifies whether the Shift key is pressed. Specifies whether the Ctrl key (Windows) or Command key (Macintosh) ctrlCmdKeyDown is pressed. altOptKeyDown Specifies whether the Alt key (Windows) or Option key (Macintosh) is pressed.
Example The following command makes one copy of the current frame and places the new frame after the current frame. fw.getDocumentDOM().duplicateFrame(-1, 1, "after current", false); dom.duplicateLayer() Availability Fireworks 3. Usage dom.duplicateLayer(layerIndex, {howMany}, {where}) Arguments} layerIndex An integer value that specifies the layer to duplicate, starting with 0 (although, to specify the current layer, pass –1 here).
Description Makes a duplicate of the selection, offsetting it slightly from the original. Example The following command duplicates the selected items. fw.getDocumentDOM().duplicateSelection(); See also dom.cloneSelection() dom.duplicateSelectionToFrameRange() Availability Fireworks 3. Usage dom.
dom.duplicateSymbol() Availability Fireworks 3. Usage dom.duplicateSymbol(symbol) Arguments symbol The symbol to duplicate. • To duplicate all selected symbols in the library (not the document), pass a null value. • Duplicating a linked symbol results in a nonlinked duplicate. Returns Nothing. Description Duplicates the specified symbol. dom.duplicateSymbolForAlias() Availability Fireworks 3. Usage dom.duplicateSymbolForAlias() Arguments None. Returns Nothing.
Arguments where Specifies which rectangle to check for elements. To find the elements under a single point (similar to selecting with the Subselection tool), set left equal to right and top equal to bottom. To find elements within a rectangle (similar to drag-selecting with the Pointer tool), set the values to the desired rectangle. Returns An array of zero of more elements. Description Returns a list of zero or more elements at the given location.
Arguments antiAlias A Boolean value to turn anti-aliasing on (true) or off (false). Returns Nothing. Description Turns anti-aliasing on or off for the selected blocks of text. dom.enterElementMaskEditMode() Availability Fireworks 4. Usage dom.enterElementMaskEditMode() Arguments None. Returns Nothing. Description Places Fireworks in element-mask edit mode for the selection. If the selection contains no mask elements, Fireworks throws an exception. dom.
dom.exitElementMaskEditMode() Availability Fireworks 4. Usage dom.exitElementMaskEditMode() Arguments None. Returns Nothing. Description Takes Fireworks out of element-mask edit mode. If Fireworks is not in this mode, this function has no effect. dom.exitPaintMode() Availability Fireworks 3. Usage dom.exitPaintMode() Arguments None. Returns Nothing. Description Leaves bitmap mode. Has no effect if Fireworks is not in bitmap mode. dom.exportOptions.loadColorPalette() Availability Fireworks 3.
Returns true if the file is read successfully; false if the file is not the expected format or is not read successfully for any other reason. Description Replaces the values in dom.exportOptions.paletteEntries with those in the specified GIF or ACT file. This function also sets dom.exportOptions.paletteMode to "custom". For more information, see “ExportOptions object” on page 46. dom.exportOptions.saveColorPalette() Availability Fireworks 3. Usage dom.exportOptions.
Returns true if the file is successfully exported; false otherwise. Description Exports the document as specified. dom.fillSelectedPixels() Availability Fireworks 3. Usage dom.fillSelectedPixels(clickPt, p1, p2, p3, bFillSelectionOnly, tolerance, edgemode, featherAmt) Arguments A point that specifies the x,y coordinates of the pixel to be filled or generated (see “Point data type” on page 11). clickPt p1, p2, and p3 Points that specify the fill-vector.
dom.filterSelection() Availability Fireworks 3. usage dom.filterSelection(LiveEffect) Arguments LiveEffect An Effect object (see “Effect object” on page 32). Returns Nothing. Description Applies the specified pixel filter to the selection. Items that are not images are converted into images before the filter is applied. Only external filters that are capable of also being Live Effects can be applied using this function. To apply other types of external filters, use dom.filterSelectionByName().
dom.findExportFormatOptionsByName() Availability Fireworks 3. Usage dom.findExportFormatOptionsByName(name) Arguments name A string that specifies the name of the set of export settings to find. Returns If there is a set of export settings with the specified name, the argument returns an object that represents it; otherwise, it returns null. Description Looks for a set of export settings that were saved with the specified name. dom.findNamedElements() Availability Fireworks 4. Usage dom.
Returns Nothing. Description Flattens the entire document into a single pixel image. This is the same behavior as the Merge Layers command. dom.flattenSelection() Availability Fireworks 3. Usage dom.flattenSelection() Arguments None. Returns Nothing. Description Flattens the selection into a single pixel image. This action is the same behavior as the Merge Images command. dom.getFontMarkup() Availability Fireworks 3. Usage dom.
dom.getPixelMask() Availability Fireworks 3, deprecated in 4. Usage dom.getPixelMask() Arguments None. Returns The mask for the current pixel selection. Returns null if Fireworks is not in bitmap mode, or if there is no pixel selection. For information on the format of mask variables, see “Mask data type” on page 11. Description Gets the current pixel-selection mask. The result of this call could be used to call “dom.enableElementMask()” on page 145 or “dom.enterPaintMode()” on page 146. dom.
Returns true if the grid is visible; false otherwise. Description Determines whether the grid is visible. dom.getShowRulers() Availability Fireworks 3. Usage dom.getShowRulers() Arguments None. Returns true if the rulers are visible; false otherwise. Description Determines whether the rulers are visible. dom.getSnapToGrid() Availability Fireworks 3. Usage dom.getSnapToGrid() Arguments None. Returns true if the Snap to Grid function is active; false otherwise.
Arguments None. Returns One of the following strings: "left", "center", "right", "justify", "stretch", "vertical left", "vertical center", "vertical right", "vertical justify", or "vertical stretch". Returns null if the text has multiple alignments or if the selection contains no text. Description Gets the alignment of selected text. dom.group() Availability Fireworks 3, argument deprecated in 4. Usage dom.group({type}) Arguments type An optional string that specifies how to group the items.
Returns if the text has the specified character markup; false if it does not or if only part of the text has the markup. true Description Determines whether the selected text has the specified character markup. dom.hideSelection() Availability Fireworks 3. Usage dom.hideSelection() Arguments None. Returns Nothing. Description Hides the selection. To redisplay it, use dom.showAllHidden() on page 238. dom.importFile() Availability Fireworks 3. Usage dom.
Example The following command imports the specified file and maintains its aspect ratio. fw.getDocumentDOM().importFile("file:///C|/images/foo.psd", {left:25, top:50, right:100, bottom:250}, true); dom.importSymbol() Availability Fireworks 3. Usage dom.importSymbol(fileURL, bAddToDoc, bAllowUI) Arguments fileURL The name of the file to be imported into the library, which is expressed as a file:// URL.
Description Extracts the component elements from the selected symbol and places copies of those elements in the document. This function is similar to the dom.importSymbol API. dom.importSymbol places an instance of a symbol in your document—for example, when you select Edit > Libraries > Buttons, and dom.importSymbolButNotAsAlias extracts the component elements from the selected symbol and places copies of those elements in the document. dom.
Returns Nothing. Description Inserts a Bézier point in the selected path. This function is similar to dom.appendPointToPath() but includes a tParameter argument, which lets you control where the point is inserted. See also dom.appendPointToPath() dom.insertSmartShapeAt() Availability Fireworks MX 2004. Usage dom.insertSmartShapeAt(name, location, useToolBlendModeOpacity) Arguments name A string specifying the name of the Auto Shape. location The upper left point of the Auto Shape.
Description Tests to see if the selected object(s) are directly above a bitmap object. The selection does not need to be contiguous, although at least one item in the selection must be directly above a bitmap. dom.joinPaths() Availability Fireworks 3. Usage dom.joinPaths() Arguments None. Returns Nothing. Description Joins the selected paths. dom.knifeElementsFromPoint() Availability Fireworks 3. Usage dom.
dom.knifeElementsFromPoints() Availability Fireworks 3. Usage dom.knifeElementsFromPoints(from, to, tolerance) Arguments from A point that specifies the x,y coordinates of the point where the user clicked and started to drag (see “Point data type” on page 11). A point that specifies the x,y coordinates of the point where the user ended the drag operation. to tolerance A floating-point value > = 0 that specifies the tolerance within which items are cut.
Description Links or unlinks the element mask on the selected element. If more than one element (or no elements) are selected when this function is called, Fireworks throws an exception. An exception is also thrown if the element has no element mask. dom.makeFind() Availability Fireworks 3. Usage dom.MakeFind(findSpec) Arguments findSpec A Find object (see “Find object” on page 20). Returns A Find object.
dom.makeActive() Availability Fireworks 3. Usage dom.makeActive() Arguments None. Returns Nothing. Description Makes the selected document active for editing. dom.mergeDown() Availability Fireworks MX. Usage dom.MergeDown() Arguments None. Returns Nothing. Description Merges selected objects to the bitmap directly below the selected objects. Succeeds only if the object immediately below the selection is a bitmap. See “dom.isSelectionDirectlyAboveBitmapObject()” on page 159. dom.
and controlPointLast Points that specify the x,y coordinates of the preceding control point, the main point, and the following control point of the new point (see “Point data type” on page 11). controlPointFirst, mainPoint, If dReapplyAttrs is true, the path has the document’s current fill, stroke, and so on reapplied to it. If it is false, the path attributes are not changed. dReapplyAttrs bClosePath If bClosePath is true, the path is marked as closed after modifying the point.
Arguments A zero-based index that specifies an index into the list of selected items, indicating which item contains the Bézier handles to move. whichPath A zero-based index that specifies the contour that contains the handles to move. For paths with multiple contours, the contours are in an arbitrary order. contourIndex ptToModify A zero-based index that specifies the point whose handles are moved.
Arguments A point that specifies the x,y coordinate values by which the handle is moved (see “Point data type” on page 11). For example, passing ({x:1,y:2}) specifies a location that is right by 1 pixel and down by 2 pixels. delta whichHandle Specifies which handle to move and can be one of the following values: "start", "end1", "end2", "rotate1", or "rotate2". (Some fills ignore "end2".) Use "rotate1" or "rotate2" to rotate the end1 or end2 point around the start point.
dom.movePixelMaskBy() Availability Fireworks 4. Usage dom.movePixelMaskBy(delta) Arguments A point that specifies the x,y coordinate values by which the bitmap mode selection is moved (see “Point data type” on page 11). For example, passing ({x:1,y:2})moves the bitmap mode selection 1 pixel to the right and 2 pixels down. delta Returns Nothing. Description Moves a bitmap mode selection by the specified amount, without moving the pixels that are within the selection. dom.
dom.movePointOnHotspotByWithFlags() Availability Fireworks MX. Usage dom.MovePointOnHotspotByWithFlags(ptToModifyIndex, delta, flags) Arguments ptToModifyIndex A zero-based index that specifies which point on the path is to move. delta A point that specifies the x-,y-coordinate values by which the point is moved (see “Point data type” on page 11). For example, passing ({x:1,y:2}) moves the point 1 pixel to the right and 2 pixels down.
dom.moveSelectionBy() Availability Fireworks 3. Usage dom.moveSelectionBy(delta, bMakeCopy, doSubSel) Arguments A point that specifies the x,y coordinate values by which the selection moved (see “Point data type” on page 11). For example, passing ({x:1,y:2}) moves the selection one pixel to the right and two pixels down. delta bMakeCopy The items that are copied instead of moved. If doSubSel is set to true, the function moves only the subselected parts of a path.
dom.moveSelectionTo() Availability Fireworks 3. Usage dom.moveSelectionTo(location, bMakeCopy, doSubSel) Arguments location A point that specifies the x-,y-coordinate values of the location to which the selection is moved or copied (see “Point data type” on page 11). bMakeCopy Specifies copying instead of moving the selection. doSubSel If doSubSel is set to true, the function moves only the subselected parts of a path. If the argument is set to false, the function moves the whole object.
dom.moveSelectionToLayer() Availability Fireworks 3, enhanced in 4. Usage dom.moveSelectionToLayer(layerIndex, bMakeCopy, {whatIfMultipleSelected}, {elementIndex}) Arguments layerIndex An integer value that specifies the layer to which the selection should be moved or copied, starting with 0 (although, to specify the current layer, pass –1 here). bMakeCopy If bMakeCopy is true, the selection is copied instead of moved.
dom.pathCrop() Availability Fireworks 3. Usage dom.pathCrop() Arguments None. Returns Nothing. Description Performs a crop operation on the selected paths. dom.pathExpand() Availability Fireworks 3. Usage dom.pathExpand(width, miter, cap, join) Arguments A floating-point value that specifies the new width of the selected paths, in pixels. width A floating-point value that specifies the new miter angle of the selected paths, in pixels. This argument is ignored if the value of join is not "miter".
Arguments A floating-point value that specifies the new width of the selected paths, in pixels. width A floating-point value that specifies the new miter angle of the selected paths, in pixels. This argument is ignored if the value of join is not "miter". miter join Acceptable values are "bevel", "round", and "miter". Returns Nothing. Description Performs an inset operation on the selected paths. dom.pathIntersect() Availability Fireworks 3. Usage dom.pathIntersect() Arguments None.
dom.pathSimplify() Availability Fireworks 3. Usage dom.pathSimplify(limit) Arguments limit is a floating-point value that specifies how much to simplify. This value corresponds to the value in the Modify > Alter Path > Simplify dialog box. Returns Nothing. Description Performs a simplify operation on the selected paths. dom.pathUnion() Availability Fireworks 3. Usage dom.pathUnion() Arguments None. Returns Nothing. Description Performs a union operation on the selected paths. dom.
Description Previews the document in the primary or secondary browser. dom.rebuildColorTable() Availability Fireworks 3. Usage dom.rebuildColorTable() Arguments None. Returns Nothing. Description Rebuilds the color table for the current export settings of the document. This is the same behavior as choosing Rebuild Color Table from the Color Table panel. dom.redo() Availability Fireworks 3. Usage dom.redo() Arguments None. Returns Nothing.
Returns Nothing. Description Forces the document to redraw itself immediately. This function is useful for providing feedback during complicated commands. dom.reflectSelection() Availability Fireworks 3. Usage dom.reflectSelection(bHoriz, bVert, opts) Arguments If bHoriz is true, the items are reflected horizontally. bHoriz bVert If bVert is true, the items are reflected vertically. opts Acceptable values are "transformAttributes", "autoTrimImages", "autoTrimImages transformAttributes".
dom.removeBehavior() Availability Fireworks 3. Usage dom.removeBehavior({event}, {eventIndex}) Arguments event An optional argument specifying the event that triggers the behavior. This argument is ignored by Fireworks. An integer value that specifies the location of the behavior to be removed, starting with 0 (although, to specify the end location, pass –1 here). This argument is optional. eventIndex If you omit both optional arguments this function removes all events from selected Hotspots and slices.
dom.removeCharacterMarkup() Availability Fireworks 3. Usage dom.removeCharacterMarkup(tag) Arguments tag Acceptable values are "b", "i", and "u", for bold, italic, and underline. Returns Nothing. Description Reapplies the default value for the specified markup type to the text in the selection. dom.removeElementMask() Availability Fireworks 4. Usage dom.
Returns Nothing. Description Reapplies the default value for the specified font attribute to the text in the selection. dom.removeFill() Availability Fireworks 3. Usage dom.removeFill() Arguments None. Returns Nothing. Description Sets the fill of the selection to None. dom.removeGuide() Availability Fireworks 3. Usage dom.removeGuide(position, guidekind) Arguments position A floating-point value that specifies the position of the guide to be removed.
dom.removeTransformation() Availability Fireworks 3. Usage dom.removeTransformation() Arguments None. Returns Nothing. Description Removes the transformations, if any, from the selected text or instances. dom.reorderFrame() Availability Fireworks 3. Usage dom.reorderFrame(frameToMove, frameToPutItBefore, bMakeCopy) Arguments frameToMove A zero-based index that specifies which frame to move or copy.
dom.reorderLayer() Availability Fireworks 3. Usage dom.reorderLayer(layerToMove, layerToPutItBefore, bMakeCopy) Arguments A zero-based index that specifies which layer to move or copy. layerToMove layerToPutItBefore A zero-based index that specifies where to place the layer to be moved or copied. For example, if you pass 1 for layerToMove and 0 for layerToPutItBefore, the second layer is placed before the first layer. bMakeCopy If bMakeCopy is true, the specified layer is copied instead of moved.
dom.replaceButtonTextStringsInInstances() Availability Fireworks 3. Usage dom.replaceButtonTextStringsInInstances(newString, uniformAttrs) Arguments newString Specifies the string to be used as replacement text. If uniformAttrs is false, each character retains the attributes of the character that was formerly in its position; that is, Fireworks preserves the existing formatting. If uniformAttrs is true, all characters assume the attributes of the first character in the string that is being replaced.
dom.resizeSelection() Availability Fireworks 3. Usage dom.resizeSelection(width, height) Arguments width and height Integers that specify the new width and height, in pixels. Returns Nothing. Description Resizes the selection to the specified pixel width and height, keeping the top-left corner of the selection in place. dom.restoreJPEGMask() Availability Fireworks 4. Usage dom.restoreJPEGMask() Arguments None. Returns Nothing. Description Restores the selection that is specified in dom.
Returns Nothing. Description Restores the selection that is specified in dom.saveSelection(). See also dom.saveSelection() dom.reversePathTextDirection() Availability Fireworks 3. Usage dom.reversePathTextDirection() Arguments None. Returns Nothing. Description For all text-on-a-path items in the selection, it reverses the direction of the text along the path. dom.rotateDocument() Availability Fireworks 3. Usage dom.
dom.rotateSelection() Availability Fireworks 3. Usage dom.rotateSelection(rotationDegrees, opts) Arguments rotationDegrees A floating-point value that specifies the number of degrees to rotate the selection. opts Acceptable values are "transformAttributes", "autoTrimImages", "autoTrimImages transformAttributes". and Returns Nothing. Description Rotates the selection clockwise by the specified number of degrees. Rotating 270º is the same behavior as rotating 90º counterclockwise. dom.
dom.saveCopyAs() Availability Fireworks 3. Usage dom.saveCopyAs(fileURL) Arguments A string, which is expressed as a file://URL, that specifies the directory and name under which the copy should be saved. fileURL Returns true if the save operation is successful; false otherwise. Description Saves a copy of the document in a specified directory with a specified name. This function does not affect the document’s filePathForSave or isDirty properties. dom.saveJPEGMask() Availability Fireworks 4.
Returns Nothing. Description Stores the current selection in bitmap mode as the saved selection. Use dom.restoreSelection() to restore the selection. See also dom.restoreSelection() dom.scaleSelection() Availability Fireworks 3. Usage dom.scaleSelection(xScaleAmount, yScaleAmount, opts) Arguments xScaleAmount and yScaleAmount Float values that specify the amount to scale the selection in the horizontal and vertical axes. Acceptable values are 0.
Arguments whatToDo Acceptable values are "expand", "contract", "border", and "smooth". • Use "expand" to expand the pixel selection outward by the number of pixels that are specified by amount. • Use "contract" to reduce the pixel selection inward by the number of pixels that are specified by amount. • Use "border" to select a band of pixels the width of amount around the edge of the pixel • selection. Use "smooth" to smooth out the edge of the pixel selection by amount.
Returns Nothing. Description Selects all the items on the given layer in the current frame. This function deselects objects on other layers. If the only element on the layer is a bitmap, Fireworks will enter paint mode on the bitmap. dom.selectChildren() Availability Fireworks 3. Usage dom.selectChildren() Arguments None. Returns Nothing. Description Selects the children, if any, of the selection.
dom.selectInverse() Availability Fireworks 3. Usage dom.selectInverse() Arguments None. Returns Nothing. Description If Fireworks is in bitmap mode and a pixel selection is active, this function inverts the pixel selection. dom.selectNone() Availability Fireworks 3. Usage dom.selectNone() Arguments None. Returns Nothing. Description Deselects any selected items.
Description Selects the parents, if any, of the selection. That is, if all the members of a group are selected, the individual members are deselected, and the group is selected. See also dom.selectChildren() dom.selectSimilar() Availability Fireworks 3. Usage dom.selectSimilar(tolerance, edgemode, featherAmt, combinemode) Arguments An integer between 0 and 255, inclusive, that specifies the tolerance for selecting pixels.
Arguments where A point that specifies the x,y coordinates of the pixel whose color is used to calculate the new mask (see “Point data type” on page 11). tolerance An integer between 0 and 255, inclusive, that specifies the tolerance for selecting pixels. edgemode Acceptable values are "hard edge", "antialias", and "feather". featherAmt An integer that edgemode is not "feather". specifies the number of pixels to feather.
dom.setAllLayersDisclosure() Availability Fireworks 4. Usage dom.setAllLayersDisclosure(bDisclosed) Arguments bDisclosed If bDisclosed is true, all the false, only layer names appear on the list. elements on all layers appear in the Layers list. If Returns Nothing. Description Specifies whether all the elements in all layers appear in the Layers list. See also dom.setLayerDisclosure() dom.setAnimInstanceLoopCount() Availability Fireworks 3, deprecated in 4 in favor of dom.setAnimInstanceNumFrames().
Returns Nothing. Description Sets the number of frames to animate the currently selected animation element. See also dom.convertToAnimSymbol() dom.setAnimInstanceOffsetDist() Availability Fireworks 4. Usage dom.setAnimInstanceOffsetDist(offsetDistPt) Arguments offsetDistPt A point that specifies the distance the animation moves in pixels. For example, passing ({x:100, y:25}) animates the symbol to the right by 100 pixels and down by 25 pixels. Returns Nothing.
Description Sets the rotation amount, in degrees, to animate the currently selected animation element. See also dom.convertToAnimSymbol() dom.setAnimInstanceScaleAmount() Availability Fireworks 4. Usage dom.setAnimInstanceScaleAmount(scaleAmount) Arguments scaleAmount A positive floating-point value that specifies the amount of scaling to be applied to the animation symbol. For example, pass 50 to scale the symbol to 50% of its current size, and pass 200 to scale it to twice its current size.
dom.setAnimInstanceStartFrame() Availability Fireworks 3, deprecated in 4 in favor of placing the animation symbol on the frame in which it should start. Usage dom.setAnimInstanceStartFrame(startFrame) Arguments An integer that corresponds to the starting frame value that appears in the Objects panel when a multiframe image instance is selected. startFrame Returns Nothing. Description Sets the start frame of the selected instances of multiframe image symbols. dom.
Returns Nothing. Description Sets the selection to the specified brush. See also dom.setBrushColor(), dom.setBrushName(), dom.setBrushNColorNTexture(), dom.setBrushPlacement() dom.setBrushColor() Availability Fireworks 3. Usage dom.setBrushColor(color) Arguments color A color string (see “Color string data type” on page 11). Returns Nothing. Description Sets the brush color of the selection to the specified color. See also dom.setBrushNColorNTexture() dom.setBrushName() Availability Fireworks 3.
dom.setBrushNColorNTexture() Availability Fireworks 3. Usage dom.setBrushNColorNTexture(brush, color, texture-name) Arguments brush A Brush object (see “Brush object” on page 26). color A color string (see “Color string data type” on page 11). texture-name The name of the texture to be applied. Returns Nothing. Description Sets the selection to the specified brush, brush color, and brush texture. See also dom.setBrushColor() dom.setBrushPlacement() Availability Fireworks 3. Usage dom.
Arguments bAutoSlice If bAutoSlice is true, automatic slicing is turned on. If bAutoSlice is false, it is turned off. Returns Nothing. Description If the user is editing a Button document, this function turns automatic slicing on or off. dom.setButtonIncludeDownState() Availability Fireworks 3. Usage dom.setButtonIncludeDownState(bIncludeDownState) Arguments bIncludeDownState If bIncludeDownState is true, the Down state is included in the button. If bIncludeDownState is false, it is not.
dom.setButtonShowDownOnLoad() Availability Fireworks 3. Usage dom.setButtonShowDownOnLoad(bShowDownOnLoad) Arguments bShowDownOnLoad If bShowDownOnLoad is true, the Down-State-on-Load is shown in the button. If bShowDownOnLoad is false, it is not. Returns Nothing. Description If the user edits a Button document, this function specifies whether to show the Down-State-onLoad in a button. dom.setButtonOptions() Availability Fireworks 3. Usage dom.
dom.setDefaultBrushAndFillColors() Availability Fireworks 3. Usage dom.setDefaultBrushAndFillColors() Arguments None. Returns Nothing. Description Resets the document’s brush and fill color to the default. dom.setDefaultFillVector() Availability Fireworks 3. Usage dom.setDefaultFillVector() Arguments None. Returns Nothing. Description Sets the fill-vector on the selection to the default. dom.setDocumentCanvasColor() Availability Fireworks 3. Usage dom.
Description Sets the canvas color of the document to the specified color. Example The following command sets the canvas color to blue. fw.getDocumentDOM().setDocumentCanvasColor("#0000ff"); dom.setDocumentCanvasSize() Availability Fireworks 3. Usage dom.setDocumentCanvasSize(boundingRectangle) Arguments boundingRectangle A rectangle that specifies the new canvas size for the document, in pixels (see “Rectangle data type” on page 11). Any items outside the specified rectangle are removed.
Example The following command resizes the canvas to include all the items in the document, enlarging the canvas if necessary. fw.getDocumentDOM().setDocumentCanvasSizeToDocumentExtents(true); See also dom.setDocumentCanvasSizeToSelection() dom.setDocumentCanvasSizeToSelection() Availability Fireworks 3. Usage dom.setDocumentCanvasSizeToSelection() Arguments None. Returns Nothing. Description Calculates the size of all the items in the selection and resizes the document canvas accordingly.
dom.setDocumentResolution() Availability Fireworks 3. Usage dom.setDocumentResolution(resolution) Arguments resolution Specifies the resolution for the document (see “Resolution data type” on page 12). Returns Nothing. Description Sets the resolution of the document. dom.setEffectName() Availability Fireworks MX. Usage dom.setEffectName(category, oldName, newName) Arguments A string that defines the name of the category of the effect. category oldName The existing name of the effect.
Returns Nothing. Description Sets the rendering mode on the selected element’s element mask. Only one element can be selected when calling this function. If more than one element (or no elements) are selected when this function is called, Fireworks throws an exception. Fireworks also returns an error if the selected element has no element mask. dom.setElementMaskShowAttrs() Availability Fireworks 4. Usage dom.
dom.setElementVisible() Availability Fireworks 4. Usage dom.setElementVisisble(frameIndex, layerIndex, elementIndex, bShow) Arguments An integer value that specifies the frame that contains the element(s) to be shown or hidden, starting with 0 (although, to specify the current frame, pass –1 here). frameIndex layerIndex An integer value that specifies the layer that contains the element(s) to be shown or hidden, starting with 0 (although, to specify the current layer, pass –1 here).
Description Shows or hides all the elements with the specified name. If no element has the specified name, an exception is thrown. If the elements are hidden because they are on a hidden layer or frame, for example, this function does not show them. See also dom.findNamedElements(), dom.setElementName(), dom.setElementVisible() dom.setExportOptions() Availability Fireworks 3. Usage dom.
Arguments fill A Fill object (see “Fill object” on page 51). Returns Nothing. Description Sets the selection to the specified fill. dom.setFillColor() Availability Fireworks 3. Usage dom.setFillColor(color) Arguments color A color string (see “Color string data type” on page 11). Returns Nothing. Description Changes the fill color of the selection to the specified color. dom.setFillEdgeMode() Availability Fireworks 3. Usage dom.
dom.setFillNColor() Availability Fireworks MX. Usage dom.setFillNColor(fill, color) Arguments fill A Fill object (see “Fill object” on page 51). A color string (see “Color string data type” on page 11). color Returns Nothing. Description Sets the selection to the specified fill and fill color. dom.setFillNColorNTexture() Availability Fireworks 3. Usage dom.setFillNColorNTexture(fill, color, texture-name) Arguments fill color A Fill object (see “Fill object” on page 51).
dom.setFillPlacement() Availability Fireworks 3. Usage dom.setFillPlacement(placement) Arguments placement Acceptable values are "top" and "bottom". Returns Nothing. Description Sets the fill placement for selected items with fills. dom.setFillVector() Availability Fireworks 3. Usage dom.setFillVector(p1, p2, p3) Arguments p1, p2, and p3 Points that specify the x,y coordinates of the three points used to calculate the fill vector (see “Point data type” on page 11). Returns Nothing.
Description Modifies the fill vectors of the selection by moving the fill start to the specified point and then moving the two fill end handles to the same relative position. dom.setGradientName() Availability Fireworks 3. Usage dom.setGradientName(urrentName, newName) Arguments currentName newName A string that specifies the current name of the gradient. A string that specifies the new name of the gradient. Returns Nothing. Description Renames a gradient. dom.
Arguments A point that specifies the x,y coordinates that are used for the document’s grid size (see “Point data type” on page 11). gridSize Returns Nothing. Description Sets the grid size for the document. dom.setGridColor() Availability Fireworks 3. Usage dom.setGridColor(gridColor) Arguments gridColor A color string (see “Color string data type” on page 11). Returns Nothing. Description Sets the color used to display the grid. dom.
dom.setGuideColor() Availability Fireworks 3. Usage dom.setGuideColor(guideColor) Arguments guideColor A color string (see “Color string data type” on page 11). Returns Nothing. Description Sets the color that is used to display normal (nonslice) guides. To set the color of slice guides, use dom.setSliceGuideColor(). See also dom.setSliceGuideColor() dom.setHotspotAltTag() Availability Fireworks 3. Usage dom.
dom.setHotspotColor() Availability Fireworks 3. Usage dom.setHotSpotColor(whatToSet, color) Arguments whatToSet color Acceptable values are "hotspots", "slices", and "hotspots and slices". A color string (see “Color string data type” on page 11). Returns Nothing. Description Sets the color to the specified value for the Hotspots and slices in the selection. Example The following command sets the color of the selected Hotspots to red. fw.getDocumentDOM().setHotspotColor("hotspots", "#ff0000"); dom.
dom.setHotspotShape() Availability Fireworks 3. Usage dom.setHotspotShape(whatToSet, shape) Arguments whatToSet shape Acceptable values are "hotspots", "slices", or "hotspots and slices". Acceptable values are "rectangle", "oval", or "polyline". Returns Nothing. Description Sets the specified Hotspots and slices in the selection to the specified shape. dom.setHotspotTarget() Availability Fireworks 3. Usage dom.
Description Sets the Hotspot text to the specified value for the Hotspots and slices in the selection. Arguments whatToSet textString Acceptable values are "hotspots", "slices", or "hotspots and slices". A string that specifies the text to be used for the Hotspot or slice. urlToMatch A string that specifies a URL that is already assigned to one or more Hotspots in the document.
Description Specifies whether the elements on a specified layer appear in the Layers list. Disclosure affects the layer, regardless of which frame appears. See also dom.setAllLayersDisclosure() dom.setLayerLocked() Availability Fireworks 3. Usage dom.setLayerLocked(layerIndex, frameIndex, bLock, bAllLayers) Arguments An integer value that specifies the layer to be locked or unlocked, starting with 0 (although, to specify the current layer, pass –1 here).
Returns Nothing. Description Renames the specified layer. Layers aren’t required to have unique names, so no duplicate checking occurs. dom.setLayerSharing() Availability Fireworks 3. Usage dom.setLayerSharing(layerIndex, sharedStatus, bUnshareCopiesToAllFrames, bWarnUser) Arguments An integer value that specifies the layer to be shared or not shared, starting with 0 (although, to specify the current layer, pass –1 here). layerIndex sharedStatus Acceptable values are "shared" or "not shared".
Arguments layerIndex An integer value that specifies the layer that should be shown or hidden, starting with 0 (although, to specify the current layer, pass –1 here). To show or hide all the layers on a frame, use the bAllLayers argument. frameIndex An integer value that specifies the frame that contains the layer to be shown or hidden, starting with 0 (although, to specify the current frame, pass –1 here). A zero-based integer specifying the frame that contains the layer to be shown or hidden.
dom.setPixelMask() Availability Fireworks 3, deprecated in 4 in favor of dom.setSelectionMask(). Usage dom.setPixelMask(mask, howToCombineMasks) Arguments mask mask A mask variable that specifies the mask to be applied (see “Mask data type” on page 11). If is null, any existing pixel-selection mask is removed. howToCombineMasks howToCombineMasks howToCombineMasks If there was previously a mask and the new mask is also not null, then specifies how the two masks should be combined.
dom.setOpacity() Availability Fireworks 3. Usage dom.setOpacity(opacity) Arguments opacity A float variable between 0 and 100, inclusive. Returns Nothing. Description Sets the opacity of the selection to the specified value. Example The following command sets the selected item to an opacity of 55%. fw.getDocumentDOM().setOpacity(55); dom.setQuadrangle() Availability Fireworks 3. Usage dom.
Example The following command performs the transform operation on the selection within the specified points: fw.getDocumentDOM().setQuadrangle({x:-0.300884962, y:0.207964599}, {x:1, y:0.207964599}, {x:1, y:0.792035401}, {x:-0.300884962, y:0.792035401}, "autoTrimImages transformAttributes"); dom.setRectRoundness() Availability Fireworks 4. Usage dom.
dom.setSelectionBounds() Availability Fireworks 3. Usage dom.setSelectionBounds(boundingRectangle, opts) Arguments boundingRectangle A rectangle that specifies the new location and size of the selection (see “Rectangle data type” on page 11). opts Acceptable values are "transformAttributes", "autoTrimImages", "autoTrimImages transformAttributes". and Returns Nothing. Description Moves and resizes the selection in a single operation. dom.setSelectionMask() Availability Fireworks 4. Usage dom.
dom.setShowEdges() Availability Fireworks 3. Usage dom.setShowEdges(bShowEdges) Arguments bShowEdges If bShowEdges is true, false, the option is turned off. the Show Edges option is turned on. If bShowEdges is Returns Nothing. Description Specifies whether the Show Edges option is on or off. dom.setShowGammaPreview() Availability Fireworks 3. Usage dom.setShowGammaPreview(bPreviewGamma) Arguments bPreviewGamma bPreviewGamma If bPreviewGamma is true, the Preview Gamma option is turned on.
Returns Nothing. Description Specifies whether the grid is visible. dom.setShowGuides() Availability Fireworks 3. Usage dom.setShowGuides(bShow) Arguments bShow If bShow is true, the normal guides are visible. If bShow is false, they are not visible. Returns Nothing. Description Specifies whether normal guides are visible. dom.setShowRulers() Availability Fireworks 3. Usage dom.setShowRulers(bShow) Arguments bShow If bShow is true, the rulers are visible. If bShow is false, they are not visible.
Arguments bShow If bShow is true, the slice guides are visible. If bShow is false, they are not visible. Returns Nothing. Description Specifies whether slice guides are visible. dom.setShowSliceOverlay() Availability Fireworks 3. Usage dom.setShowSliceOverlay(bShow) Arguments bShow If bShow is true, the slice overlay is visible. If bShow is false, it is not visible. Returns Nothing. Description Specifies whether the slice overlay is visible. dom.setSliceAutonaming() Availability Fireworks 3.
dom.setSliceExportOptions() Availability Fireworks 3. Usage dom.setSliceExportOptions(exportOptions) Arguments exportOptions An ExportOptions object (see “ExportOptions object” on page 46). Returns Nothing. Description Sets the export options for the selected slices. dom.setSliceFilename() Availability Fireworks 3. Usage dom.setSliceFilename(fileURL) Arguments A string, which is expressed as a file://URL, that specifies the name to be given to fileURL the slice. Returns Nothing.
Description Sets the color that is used to display slice guides. To set the color of normal guides, use dom.setGuideColor(). See also dom.setGuideColor() dom.setSliceHtml() Availability Fireworks 3. Usage dom.setSliceHtml(htmlText) Arguments htmlText A string that specifies the HTML text for the slice. Returns Nothing. Description If a single slice is selected, this function sets the slice’s HTML text. dom.setSliceIsHtml() Availability Fireworks 3. Usage dom.
Arguments bSnap If bSnap is true, the tools snap to the grid. If bSnap is false, they do not. Returns Nothing. Description Specifies whether tools snap to the grid. dom.setSnapToGuides() Availability Fireworks 3. Usage dom.setSnapToGuides(bSnap) Arguments bSnap If bSnap is true, the tools snap to all guides. If bSnap is false, they do not. Returns Nothing. Description Specifies whether tools snap to guides. dom.setSymbolProperties() Availability Fireworks 3. Usage dom.
dom.setTextAlignment() Availability Fireworks 3. Usage dom.setTextAlignment(alignment) Arguments alignment Acceptable values alignment are "left", "center", "right", "justify", "stretch", "vertical left", "vertical center", "vertical right", "vertical justify", and "vertical stretch". Returns Nothing. Description Sets the alignment of the selected text items. dom.setTextAntiAliasing() Availability Fireworks 3. Usage dom.
Arguments bKern If bKern is true, automatic kerning is on for the selected text items. If bKern is false, it is off. Returns Nothing. Description Specifies whether automatic kerning is on or off for the selected text items. dom.setTextCharSpacing() Availability Fireworks MX. Usage dom.setTextCharSpacing(charSpace) Arguments A floating-point percentage of the default space to add to (positive values) or remove from (negative values) two adjacent characters.
dom.setTextCustomAntiAliasSharpness() Availability Fireworks MX 2004. Usage dom.setTextCustomAntiAliasSharpness(sharpness) Arguments An integer from 0 to 255. sharpness Returns Nothing. Description Sets the sharpness value used to anti-alias text in custom mode. dom.setTextCustomAntiAliasStrength() Availability Fireworks MX 2004. Usage dom.setTextCustomAntiAliasStrength(strength) Arguments Strength An integer value, from 0 to 255, for the amount of anti-aliasing to apply. Returns Nothing.
Returns Nothing. Description Sets the horizontal flow direction of the selected text items. dom.setTextHorizontalScale() Availability Fireworks MX. Usage dom.setTextHorizontalScale(horizScale) Arguments A floating-point number that describes how much to scale the text characters horizontally. A value of 1.0 is normal. Values greater than 1.0 make the characters wider, and values less than 1.0 make the characters narrower. horizScale Returns Nothing. Description Sets the horizontal scaling of text.
dom.setTextOnPathMode() Availability Fireworks 3. Usage dom.setTextOnPathMode(mode) Arguments mode Acceptable values "skew horizontal". are "rotate", "vertical", "skew vertical", and Returns Nothing. Description Determines how the selected text-on-a-path items are displayed. dom.setTextOnPathOffset() Availability Fireworks 3. Usage dom.setTextOnPathOffset(offset) Arguments offset A floating-point value that specifies the offset distance, in pixels. Returns Nothing.
Returns Nothing. Description Sets the horizontal/vertical text orientation of the selected text items. dom.setTextParaIndent() Availability Fireworks MX. Usage dom.setTextParaIndent(paraIndent) Arguments paraIndent The number of pixels by which to indent the first line of a paragraph. Returns Nothing. Description Sets the paragraph indention of text, in pixels. dom.setTextParaSpacingAfter() Availability Fireworks MX. Usage dom.
dom.setTextParaSpacingBefore() Availability Fireworks MX. Usage dom.setTextParaSpacingBefore(paraSpaceBefore) Arguments paraSpaceBefore The number of pixels to move down before starting a new paragraph. Returns Nothing. Description Sets the before-paragraph spacing for text; that is, the number of pixels to move down from the previous paragraph before starting the new paragraph. For vertical text mode, this function defines the vertical distance between paragraphs. If you apply dom.
Arguments mode Acceptable values are "paths" and "pixels". Returns Nothing. Description Sets the transform mode for the selected text, instance items, or both. dom.setTextRectangle() Availability Fireworks 3. Usage dom.setTextRectangle(boundingRectangle) Arguments boundingRectangle A rectangle that specifies the new size within which the text item should flow (see “Rectangle data type” on page 11). Returns Nothing.
dom.setTextRectangleAutoFromPoint() Availability Fireworks 3. Usage dom.setTextRectangleAutoFromPoint(anchorPoint) Arguments anchorPoint A point that specifies the x,y coordinates of the location at which the text box should be anchored (see “Point data type” on page 11). How the point is used depends on the left-to-right and up-to-down orientation of the text flow in the text block. • Left-justified horizontal text is placed with its top and left edges at anchorPoint, and the text expands to the right.
dom.splitPaths() Availability Fireworks 3. Usage dom.splitPaths() Arguments None. Returns Nothing. Description Splits the selected paths. Compound paths are split into separate contours. dom.swapBrushAndFillColors() Availability Fireworks 3. Usage dom.swapBrushAndFillColors() Arguments None. Returns Nothing. Description Swaps the current brush color and current fill color. This function has no effect on any selected items. dom.transformSelection() Availability Fireworks 3, enhanced in 4. Usage dom.
Returns Nothing. Description Transforms the selection using the specified three-by-three matrix. dom.tween() Availability Fireworks 3. Usage dom.tween() Arguments numSteps An integer that specifies how many new instances are generated. bDistribute If bDistribute is true, the new instances are distributed to frames. Returns Nothing. Description Tweens between the two selected instances. dom.undo() Availability Fireworks 3. Usage dom.undo() Arguments None. Returns Nothing.
dom.updateSymbol() Availability Fireworks 3. Usage dom.updateSymbol(name) Arguments The name of a symbol in the library. If more than one symbol exists with a name of name, then only the first symbol with that name is updated. If null is passed in for name, then all the selected linked symbols in the library (not the document) are updated. name Returns Nothing. Description Updates the specified linked symbol. dom.ungroup() Availability Fireworks 3. Usage dom.ungroup() Arguments None.
fw.browseDocument() Availability Fireworks 3. Usage fw.browseDocument(URL) Arguments URL The URL of the page appear in the browser. Any legal URL (including http://, ftp://, and so on) can be passed. Fireworks does not check this argument for syntax; if you pass an illegal value, the browser does not open the URL. Returns Nothing. Description Opens the user’s primary browser and displays the specified URL. fw.browseForFileURL() Availability Fireworks 3. Usage fw.
Arguments title null, a An optional string that specifies a title for the dialog box that appears. If it is omitted or default title appears. startFolder An optional string that serves as the root directory for the dialog box that appears. If it is omitted or null, the browse dialog box displays an unspecified directory, depending on your system configuration. Generally, it is the last directory used. Description Displays a dialog box that lets a user select a particular directory. fw.
fw.chooseBrowser() Availability Fireworks MX. Usage fw.chooseBrowser(primaryBrowser) Arguments primaryBrowser A Boolean value that indicates which browser to select. If primaryBrowser is true, Fireworks prompts the user to set the primary browser; if the argument is false, Fireworks prompts the user to set the secondary browser. Returns Nothing. Description Displays a dialog box that lets the user select a primary or secondary browser. fw.chooseScriptTargetDialog() Availability Fireworks 4. Usage fw.
fw.closeDocument() Availability Fireworks 3. Usage fw.closeDocument(document, {bPromptToSaveChanges}) Arguments document A Document object that specifies the document to close (see “Document object” on page 13). bPromptToSaveChanges An optional Boolean argument. If bPromptToSaveChanges is true or omitted and the document has changed since the last time it was saved, the user is prompted to save changes to the document.
fw.createDocumentWithDialog() Availability Fireworks MX 2004. Usage fw.createDocumentWithDialog() Arguments None. Returns The Document object for the newly created document (see “Document object” on page 13). Description Shows the New Document dialog box and allows the user to create a new document. fw.createFireworksDocument() Availability Fireworks 3. Usage fw.
fw.disableFlashDebugging() Availability Fireworks MX Usage fw.disableFlashDebugging() Arguments None. Returns Nothing. Description Turns off debugging messages for Flash commands. For a description of the Flash debugging capabilities, see fw.enableFlashDebugging() on page 247. For more information about constructing Flash command panels for Fireworks, see “Flash panels” on page 90. Note: The debugging commands work even if you are running a JavaScript file. fw.
Arguments None. Returns Nothing. Description Turns on debugging messages for Flash commands. When Flash debugging is enabled, Fireworks displays the command string in a dialog box every time a Flash command calls MMExecute(). The fw.enableFlashDebugging() function is particularly useful for monitoring which commands are executed in a command panel. See “fw.disableFlashDebugging()” on page 247 for details on how to turn off Flash debugging.
Returns A Boolean value: true if successful; false otherwise. Description Exports the specified document to the specified file as layers to be imported into Macromedia Director. fw.exportDirectorAsSlices() Availability Fireworks MX. Usage fw.exportDirectorAsSlices(document, fileURL) Arguments document A Document object, for example, fw.documents[2], that specifies the document to export. If document is null, the active document is exported. Specifies the filename for the exported file.
Description Exports the specified document to the specified file. See also fw.exportHtmlAndImages() fw.exportFrames() Availability Fireworks 4. Usage fw.exportFrames(docObject, directoryURL) Arguments A Document object that specifies the document that contains the frames to export (see “Document object” on page 13). To export frames from the current document, pass null. docObject directoryURL The directory where the images will be placed, which is expressed as a file:// URL.
Returns A Boolean value: true if successful; false otherwise. Description Exports one image if the document contains no slice objects and multiple images if the document contains one or more slice objects. It also optionally exports HTML. The document is exported using the current export settings and export options. Example The following command exports the current document as HTML and as one or more images. fw.exportHtmlAndImages(null, "file:///C|/mysite/nav.htm", "file:///C|/mysite/ images/nav.
Arguments docObject A Document object that specifies the document that contains the layers to export (see “Document object” on page 13). To export layers from the current document, pass null. directoryURL The directory in which the images will be placed, which is expressed as a file:// URL. Returns A Boolean value: true if successful; false otherwise. Description Exports a document’s layers as individual images. The image names are based on the names in the Layers panel.
Example The Photoshop writer is controlled by the values of several preferences. See the following example for allowed values. A well-behaved script should restore the original values after exporting the file. var prevWarn = fw.getPref("PsdExport_Warn100"); // bool fw.setPref("PsdExport_Warn100", false); // don't warn. var kObjToLayer = 1; var kFlatten = 2; var prevLayers = fw.getPref("PsdExport_Layers"); fw.setPref("PsdExport_Layers", kObjToLayer); // flatten layers or not.
Example The Macromedia Flash writer is controlled by the values of several preferences. See the following example for allowed values. A well-behaved script should restore the original values after exporting the file. var prevMaintainObjEditable = fw.getPref("SwfMaintainObjEditable"); fw.setPref("SwfMaintainObjEditable", true); // maintain non-text editability //at expense of appearance or not var prevMaintainTextEditable = fw.getPref("SwfMaintainTextEditable"); fw.
Description Attempts to find the path to the requested application. On the Macintosh, Fireworks looks for the application using a four-character signature code. In Windows, Fireworks looks in the Windows registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths. See also fw.launchApp() fw.findNext() Availability Fireworks 3. Usage fw.findNext() Arguments None.
fw.getDocumentDOM() Availability Fireworks 3. Usage fw.getDocumentDOM({which-string}) Arguments which-string An optional string that is included for compatibility with Dreamweaver. If specified here, it must be "document". Returns The Document object for the active document, or null if no document is open. Description Gets the Document object for the active document (see “Document object” on page 13). fw.getDocumentPath() Availability Fireworks 3. Usage fw.
Returns An array like the one in the following example: [ [ "stroke", "fill", "effect" ], [ "layers", "frames", "object" ], [ "mixer", "options", "swatches", "info" ], [ "styles", "library" ], [ "find", "project log" ], [ "url" ], [ "optimize", "optimized colors" ], [ "behaviors" ], [ "history" ] ] Note: Any panels not specified in the list of valid arguments (like those in the Command Panels folder which are “outside” the Fireworks application) should be named exactly as they appear in the file system wit
Arguments panelName Acceptable values are "find", "project log", "object", "info", "url", "effect", "history", "mixer", "fill", "stroke", "swatches", "layers", "frames", "behaviors", "optimize", "library", "styles", "optimized colors", "options", and "toolbox". Note: Any panels not specified in the list of valid arguments (like those in the Command Panels folder which are “outside” the Fireworks application) should be named exactly as they appear in the file system without their file extension.
fw.getNumberOfTables() Availability Fireworks MX. Usage fw.getNumberOfTables(filename) Arguments filename The name of the file that contains the tables to be counted. Returns A long integer that represents the number of tables in the document. Description Returns the number of top-level (that is, non-nested) tables in a document. fw.getPref() Availability Fireworks 3. Usage fw.getPref(prefkey) Arguments prefkey A string that specifies the Preference value to return.
Arguments A file URL that specifies the executable to start. Typically, this value can be obtained by calling fw.findApp(). appPath filePathsToOpen An array of file URLs to open in the executable to start. It is safe to pass an empty array. Returns A Boolean value that indicates whether the application started successfully. Description Starts an application using a file URL that is returned by fw.findApp(). You can specify, optionally, files to open in the application. See also fw.findApp() fw.
A list of acceptable file types to open. The formatlist argument is an array of strings such as the ones shown in the following example: formatlist ["formatname1","formatname2","formatname3",…"formatnameN"] The following table lists acceptable values for formatname and the file type each value represents.
Returns If any of the files can be opened, returns the Document object for each file. Returns null if none of the documents can be opened. Description Opens the specified files in new document windows. If a file is already open, it opens again; to avoid redundant open operations, call findOpenDocument() first. See also fw.findOpenDocument() fw.popupColorPicker() Availability Fireworks MX. Usage fw.
allowTransparent A Boolean value that lets the user select a transparent color; set to true for transparent, false otherwise. forceWeb216 A Boolean value that forces the chosen color to fall within the web216 panel; set to true to force the color change, false otherwise. Returns The chosen color in #rrggbbaa format (For syntax details, see “Color string data type” on page 11). Description Opens the color pop-up window at the current mouse location to let the user select a color. fw.
fw.readNthTable() Availability Fireworks MX. Usage fw.readNthTable(filename, tablenumber) Arguments filename A fileURL for the file that contains the desired table. tablenumber A long integer that specifies the desired table; the tables are zero-indexed. Returns A database that is constructed from the table data. Description Reads the specified table. The tables are zero-indexed. fw.readPanelStateFromFile() Availability Fireworks MX. Usage fw.
Returns The number of items that are replaced, or –1 if there are items in the document that remain to be searched. Description Verifies that the selection matches the current search string and replaces it with the replacement string. See also fw.setUpFindReplace() fw.replaceAll() Availability Fireworks 3. Usage fw.replaceAll() Arguments None. Returns The number of items replaced, or –1 if the search is not yet complete.
Returns Nothing. Description Restores the specified document to its previously saved version. fw.runScript() Availability Fireworks 3. Usage fw.runScript(filename) Arguments filename The name of the script file to execute. If filename is not a file URL (that is, if it does not begin with "file:///"), it is assumed to be the name of a file in the Fireworks MX/ Configuration/Commands folder. Returns Result of script. Description Executes a JavaScript file.
fw.saveDocument() Availability Fireworks 3. Usage fw.saveDocument(document, {fileURL}) Arguments A Document object, for example, fw.documents[2], that specifies the document to be saved. If document is null, the active document is saved. document fileURL The name of the saved document, which is expressed as file://URL. This argument is optional. If fileURL is null or omitted, the document is saved with its current name; if the document has not been saved, the Save As dialog box appears.
fw.saveDocumentCopyAs() Availability Fireworks 3. Usage fw.saveDocumentCopyAs(document, fileURL) Arguments document A Document object, for example, fw.documents[2], that specifies the document to be saved. If document is null, the active document is saved. The filename for the saved file, which is expressed as a file://URL. If fileURL is null, the Save As dialog box appears. fileURL Returns The file URL for the saved document, or null if the dialog box was canceled.
fw.setActiveViewScale() Availability Fireworks MX. Usage fw.setActiveViewScale(scale, center) Arguments scale A floating-point number where 1.0 is 100%, or normal view, and 1.5 is 150%. Default is 6%. center A point that defines the location in the document at which the view should be centered. This argument can be used to navigate around different parts of the document. Returns Nothing. Description Sets the zoom amount and the center of the view for the current document. fw.
fw.setFloaterGrouping() Availability Fireworks 3. Usage fw.setFloaterGrouping(panelNameToMove, panelNameToReceive) Arguments panelNameToMove A lowercase string that specifies the panel to be moved. panelNameToReceive A lowercase string that specifies the panel into which the panelNameToMove panel should move. If panelNameToReceive is null, the panelNameToMove panel moves into its own panel.
Arguments panelName Acceptable values are "find", "project log", "object", "info", "url", "effect", "history", "mixer", "fill", "stroke", "swatches", "layers", "frames", "behaviors", "optimize", "library", "styles", "optimized colors", "options", and "toolbox". Note: Any panels not specified in the list of valid arguments (like those in the Command Panels folder which are “outside” the Fireworks application) should be named exactly as they appear in the file system without their file extension.
fw.setHideAllFloaters() Availability Fireworks 3. Usage fw.setHideAllFloaters(bHide) Arguments bHide If bHide is true, the panels are hidden. If bHide is false, the panels are visible. Returns Nothing. Description Shows or hides the panels. This behavior is the same as the Tab key behavior. fw.setPref() Availability Fireworks 3. Usage fw.
Returns Nothing. Description Sets up a search. fw.toggleFloater() Availability Fireworks 3. Usage fw.toggleFloater(panelName) Arguments panelName Acceptable values are "find", "project log", "object", "info", "url", "effect", "history", "mixer", "fill", "stroke", "swatches", "layers", "frames", "behaviors", "optimize", "library", "styles", "optimized colors", "options", and "toolbox".
Description Replaces selected primitive objects with their equivalent paths. The new objects have all the attributes (mask, stroke, fill, and so on) of the replaced ones. See also dom.addNewRectanglePrimitive() fw.updateHTML() Availability Fireworks 4. Usage fw.updateHTML(doc, htmlUrl, bRecoverFromError) Arguments doc A Document object that specifies the document to be used for updating the HTML (see “Document object” on page 13). If doc is null, the active document is used.
Returns Nothing. Description Writes out the panel states (location, size, open or closed, and so on), toolbox state, and Property inspector state to an XML file that is specified by the argument. fw.yesNoDialog() Availability Fireworks MX. Usage fw.yesNoDialog(promptString) Arguments promptString The prompt message that appears in the dialog box. Returns A Boolean value: true if the user selected the Yes button; false otherwise.
Returns Nothing. Description Opens the Property inspector. fw.hidePIWindow() Availability Fireworks MX. Usage fw.hidPIWindow() Arguments None. Returns Nothing. Description Makes the Property inspector window invisible. fw.isPIExpanded() Availability Fireworks MX. Usage fw.isPIExpanded() Arguments None. Returns A Boolean value: true if expanded; false otherwise. Description Determines whether the Property inspector window is currently expanded or minimized fw.
Arguments None. Returns A Boolean value: true if visible; false otherwise. Description Determines whether the Property inspector window is currently hidden or shown. fw.growPIWindow() Availability Fireworks MX. Usage fw.growPIWindow() Arguments None. Returns Nothing. Description Expands the Property inspector window. fw.shrinkPIWindow() Availability Fireworks MX. Usage fw.shrinkPIWindow() Arguments None. Returns Nothing. Description Minimizes the Property inspector window.
fw.setPIPosition() Availability Fireworks MX. Usage fw.setPIPosition(pt) Arguments pt A point in screen coordinates. Returns Nothing. Description Moves the upper left corner of the Property inspector window to the specified location. fw.getPIPosition() Availability Fireworks MX. Usage fw.getPIPosition() Arguments None. Returns A point object that is formatted as {x: float, y: float} (see “Point data type” on page 11 for syntax details), which contains the location of the Property inspector.
Arguments None. Returns Nothing. Description Clears the undo and redo stack. fw.historyPalette.copySteps() Availability Fireworks 3. Usage fw.historyPalette.copySteps(array of indexes) Arguments array of indexes A zero-based array that specifies which steps from the History panel should be copied. If it is null, the currently selected steps are used. Returns Nothing. Description Copies history steps to the Clipboard. fw.historyPalette.getSelection() Availability Fireworks 3. Usage fw.history.Palette.
fw.historyPalette.getStepCount() Availability Fireworks 3. Usage fw.historyPalette.getStepCount() Arguments None. Returns The number of steps in the History panel (not a zero-based value). Description Gets the number of steps in the History panel. fw.historyPalette.getStepsAsJavaScript() Availability Fireworks 3. Usage fw.historyPalette.getStepsAsJavaScript(rray of indexes) Arguments array of indexes A zero-based array that specifies which steps from the History panel should be returned as JavaScript.
Returns The string to use with fw.historyPalette.setUndoState(). Description Returns a string that indicates the current undo state to be used for later calls to fw.historyPalette.setUndoState(). This string is designed to be used internally by Fireworks only and might change format in the future. Do not try to parse this string or construct a custom string to pass to fw.historyPalette.setUndoState(). See also fw.historyPalette.setUndoState() fw.historyPalette.replaySteps() Availability Fireworks 3.
Arguments array of indexes Indicates which steps from the History panel should be saved. For example, to save the first, third, and sixth steps in the History panel, pass [0, 2, 5]. If this argument is null, the currently selected steps are used. An optional string that specifies a name for the JSF command file. It can be any string, including a file:// URL. If filename is omitted or null, the user is prompted for a filename.
Description Performs the correct number of undo or redo operations to arrive at the selected state. See Also fw.historyPalette.getUndoState() Using the common API You can use the common Macromedia 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 app.methodName().The following methods are currently supported in Fireworks and Dreamweaver to let developers easily create commands for both applications. app.
Chapter 5: Fireworks JavaScript API
INDEX A ActionScript 90 cross-product extensions 77 addBehavior() 104, 105 addElementMask() 109 addFrames() 109 addGuide() 110 addNewHotspot() 110 addNewImage() 111, 112 addNewImageViaCopy() 111 addNewImageViaCut() 112 addNewLayer() 112 addNewLine() 113 addNewOval() 113 addNewRectangle() 114 addNewRectanglePrimitive() 114 addNewSinglePointPath() 115 addNewStar() 116 addNewSymbol() 116 addNewText() 117 addSwapImageBehaviorFromPoint() 117 AddToAutoReleasePool() 86 adjustExportToSize() 118 adjustFontSize() 11
clipCopyAsPaths() 126 clipCopyFormats() 127 clipCut() 127 clipPaste() 127 clipPasteAsMask() 128 clipPasteAttributes() 129 clipPasteFromChannelToChannel() 129 clipPasteInside() 130 cloneSelection() 131 close() 131 closeDocument() 245 color string 11 colors, finding and replacing 21 Common Application API 283 confirm() 12 Contour object 29 ContourNode object 29 ContourNodeDynamicInfo object 31 Contrast properties (Effect object) 34 ControlPoint object 31 conventions, in book 7 Convert to Alpha properties (Eff
dom.applyFontMarkup() 122 dom.applyStyle() 123 dom.arrange() 123 dom.attachTextToPath() 124 dom.changeGuide() 124 dom.changeSliceGuide() 125 dom.clearJPEGMask() 125 dom.clipCopy() 126 dom.clipCopyAsPaths() 126 dom.clipCopyFormats() 127 dom.clipCut() 127 dom.clipPaste() 127 dom.clipPasteAsMask() 128 dom.clipPasteAttributes() 129 dom.clipPasteFromChannelToChannel() 129 dom.clipPasteInside() 130 dom.cloneSelection() 131 dom.close() 131 dom.convertAnimSymbolToGraphicSymbol() 132 dom.
dom.moveSelectionToFrame() 170 dom.moveSelectionToLayer() 171 dom.moveSelectionToNewLayer() 171 dom.pathCrop() 172 dom.pathExpand() 172 dom.pathInset() 172 dom.pathIntersect() 173 dom.pathPunch() 173 dom.pathSimplify() 174 dom.pathUnion() 174 dom.previewInBrowser() 174 dom.rebuildColorTable() 175 dom.redo() 175 dom.redraw() 175 dom.reflectSelection() 176 dom.removeAllGuides() 176 dom.removeBehavior() 177 dom.removeBrush() 177 dom.removeCharacterMarkup() 178 dom.removeElementMask() 178 dom.
dom.setGuideColor() 213 dom.setHotspotAltTag() 213 dom.setHotspotColor() 214 dom.setHotspotRectangle() 214 dom.setHotspotShape() 215 dom.setHotspotTarget() 215 dom.setHotspotText() 215 dom.setLayerDisclosure() 216 dom.setLayerLocked() 217 dom.setLayerName() 217 dom.setLayerSharing() 218 dom.setLayerVisible() 218 dom.setMatteColor() 219 dom.setOnionSkinning() 220 dom.setOpacity() 221 dom.setPixelMask() 220 dom.setQuadrangle() 221 dom.setRectRoundness() 222 dom.setRectSides() 222 dom.
EGenericErrorOccurred 17 EGroupDepth 17 EIllegalThreadAccess 17 EInternalError 17 Element object 39 ElementMask object 45 elements, changing 10 elementsAt() 144 ELowOnMem 17 enableElementMask() 145 enableFlashDebugging() 247 enableTextAntiAliasing() 145 end-of-line character 12, 19 EndDragControlPoint 98 EndDragInsert 98 ENoActiveDocument 17 ENoFilesSelected 17 ENoNestedMastersOrAliases 17 ENoNestedPasting 17 ENoSliceableElems 17 ENoSuchElement 17 ENotImplemented 17 ENotMyType 17 enterElementMaskEditMode()
fw and fireworks class names 241 fw.browseDocument() 242 fw.browseForFileURL() 242 fw.browseForFolderURL() 242 fw.browseHelp() 243 fw.checkFwJsVersion() 243 fw.chooseBrowser() 244 fw.chooseScriptTargetDialog() 244 fw.closeDocument() 245 fw.createDocument() 245 fw.createDocumentWithDialog() 246 fw.createFireworksDocument() 246 fw.disableFlashDebugging() 247 fw.dismissBatchDialogWhenDone() 247 fw.enableFlashDebugging() 247 fw.exportAndCopyHTMLCode() 248 fw.exportDirectorAsLayers() 248 fw.
getHideAllFloaters() 258 getHTMLFileForScript() 258 getNumberOfTables() 259 getPIPosition() 278 getPixelMask() 153 getPref() 259 getRootDirectory() 283 getSelection() 279 getSelectionBounds() 153 getShowGrid() 153 getShowRulers() 154 getSnapToGrid() 154 getStepCount() 280 getStepsAsJavaScript() 280 getTextAlignment() 154 getUndoState() 280 Global methods 12 Gradient object 53 GradientNode object 53 Group object 40 group() 155 growPIWindow() 277 Guides object 53 H hasCharacterMarkup() 155 hidePIWindow() 276
mergeDown() 163 Metafile.
pathCrop() 172 pathExpand() 172 pathInset() 172 pathIntersect() 173 pathPunch() 173 pathSimplify() 174 pathUnion() 174 Pattern object 55 Photoshop document, exporting as 252 pngText 16 point 11 popupColorPicker() 262 popupColorPickerOverMouse() 262 previewInBrowser() 174 primitive 115 prompt() 12 property types effectList 73 PSD, exporting as 252 Q quit() 263 quitApplication() 263 R readNthTable() 264 readPanelStateFromFile() 264 rebuildColorTable() 175 rectangle 11 rectangle primitive 115 redo() 175 redraw
selectInverse() 190 selectNone() 190 selectParents() 190 selectSimilar() 191 selectSimilarFromPoint() 191 sendEmail() 192 set 79 setActiveViewScale() 269 setActiveWindow() 269 setAllLayersDisclosure() 193 setAnimInstanceLoopCount() 193 setAnimInstanceNumFrames() 193 setAnimInstanceOffsetDist() 194 setAnimInstanceRotationAmount() 194 setAnimInstanceScaleAmount() 195 setAnimInstanceStartEndOpacity() 195 setAnimInstanceStartFrame() 196 setBlendMode() 196 setBrush() 196 setBrushColor() 197 setBrushName() 197 se
setSnapToGrid() 228 setSnapToGuides() 229 setSymbolProperties() 229 setTextAlignment() 230 setTextAntiAliasing() 230 setTextAutoKern() 230 setTextCharSpacing() 231 setTextCustomAntiAliasOverSample() 231 setTextCustomAntiAliasSharpness() 232 setTextCustomAntiAliasStrength() 232 setTextFlow() 232 setTextHorizontalScale() 233 setTextLeading() 233 setTextOnPathMode() 234 setTextOnPathOffset() 234 setTextOrientation() 234 setTextParaIndent() 235 setTextParaSpacingAfter() 235 setTextParaSpacingBefore() 236 setTex