Advertisement

Quick Links

Extending Fireworks

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FIREWORKS 8-EXTENDING FIREWORKS and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for MACROMEDIA FIREWORKS 8-EXTENDING FIREWORKS

  • Page 1 Extending Fireworks...
  • Page 2 If you access a third-party website mentioned in this guide, then you do so at your own risk. Macromedia provides these links only as a convenience, and the inclusion of the link does not imply that Macromedia endorses or accepts any responsibility for the content on those third-party sites.
  • Page 3: Table Of Contents

    Contents Chapter 1: Extending Fireworks Overview ....5 Prerequisites ........... 5 Installing an extension .
  • Page 4 Contents...
  • Page 5: Chapter 1: Extending Fireworks Overview

    Extending Fireworks Overview To extend Macromedia Fireworks 8, 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.
  • Page 6: Installing An Extension

    To install an extension: Download and install the Extension Manager, which is available on the Macromedia Downloads website (www.macromedia.com/software/downloads). Log on to the Macromedia Exchange website (www.macromedia.com/exchange).
  • Page 7: Conventions Used In This Guide

    Vector path compatibility with Macromedia FreeHand Although Fireworks 8 imports winding fills from FreeHand MX, it does not provide a user interface that lets you create a winding fill. However, Fireworks 8 has APIs that let third-party developers create an interface where a user can specify if a path uses an even/odd or winding fill.
  • Page 8: Additional Resources For Extension Writers

    Additional resources for extension writers To communicate with other developers who are writing extensions, you can visit the Fireworks online forums at www.macromedia.com/go/13012. Extending Fireworks Overview...
  • Page 9: Chapter 2: The Fireworks Object Model

    CHAPTER 2 The Fireworks Object Model If you want to extend the functionality of Macromedia Fireworks 8 by writing or modifying a JavaScript extensibility file, you must become familiar with the objects that Fireworks makes available through JavaScript. The hierarchy of these objects comprises the Fireworks Object...
  • Page 10 Accessing a Fireworks document All the functions listed in “Document functions” on page 132 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.
  • Page 11 For example, if the first open document is the current document, the first code fragment has the same effect as the second and third code fragments. The function fw.getDocumentDOM() references the current document (for more information, see “Accessing a Fireworks document”...
  • Page 12: Global Methods

    Matrix data type The format for a matrix is {matrix: [float, float, float, float, float, float, . This guide assumes that you know how to use these nine values to float, float, float]} construct a three-by-three transformation matrix; discussion of the construction of transformation matrices is beyond the scope of this manual.
  • Page 13: Core Objects

    Method Data type Notes string, string Prompts the user (with the string that is prompt(caption text) specified by text) to enter a string in a modal dialog box; the dialog box is titled with the string that is specified by caption. Returns the string entered if OK is clicked, if Cancel is clicked.
  • Page 14 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”...
  • Page 15 Property Data type Notes string The path to the file from which this filePathForRevert document was opened, which is expressed as file://URL, or if created from null scratch. string The location to which this document was filePathForSave saved, which is expressed as file://URL, or if never saved.
  • Page 16 Property Data type Notes integer Total height of the document, in pixels. height To find the bottom edge of the document, use document. top + document.height. Boolean Set to if the document was modified isDirty true since the last ti me it was saved. Boolean Set to if the document is currently in...
  • Page 17 Property Data type Notes string Acceptable values are mapType "client" "server" . Corresponds to the image-map "both" type selected in File > HTML Properties > ImageMap. string A color string that corresponds to the matte matteColor color specified in the Optimize panel (for more information, see “Color string data type”...
  • Page 18 The software used to create the document. The current version of Software Fireworks always sets this value to “Macromedia Fireworks 8.” You can edit these or add your own fields, and they will be preserved across file saves. The pngText object corresponds directly to the chunk of the document’s PNG...
  • Page 19 The following list contains the properties of the Errors object alphabetically: EAppAlready , EAppNotSerialized, EArrayIndexOutOfBounds, EBadFileContents, EBadJsVersion, EBadNesting, EBadParam, EBadParamType, EBadSelection, EBufferTooSmall, ECharConversionFailed, EDatabaseError, EDeletingLastMasterChild, EDiskFull, EDuplicateFileName, EFileIsReadOnly, EFileNotFound, EGenericErrorOccurred, EGroupDepth, EIllegalThreadAccess, EInternalError, ELowOnMem, ENoActiveDocument, ENoActiveSelection, ENoFilesSelected, ENoNestedMastersOrAliases, ENoNestedPasting, ENoSliceableElems, ENoSuchElement, ENotImplemented, ENotMyType, EOutOfMem, EResourceNotFound, ESharingViolation, EUnknownReaderFormat, EUserCanceled, EUserInterrupted, EWrongType Files object...
  • Page 20 Method Data type Notes string Deletes the specified file or directory. deleteFile(docOrDir) Returns if successful; if the true false file or directory does not exist or cannot be deleted. Compare with deleteFileIfExisting() string Deletes the specified file or directory. deleteFileIfExisting (docOrDir) Returns if successful;...
  • Page 21 Method Data type Notes none If the last call to a method in a Files getLastErrorString() object resulted in an error, returns a string that describes the error. If the last call succeeded, returns null string The argument, if used, must be getTempFilePath ({dirname}) expressed as file://URL.
  • Page 22 Method Data type Notes string, string argument is a file path or a rename(docname, docname newPlainFilename) file URL to the file that you want to rename. argument is the newPlainFilename new name to assign to the file. method returns a URL path rename of the newly renamed file if successful;...
  • Page 23 File Reference object The File Reference object is used to refer to a specific open file. The following table lists the methods of the File Reference object, along with their data types and, where appropriate, acceptable values and notes. Method Data Type Notes none...
  • Page 24 Property Data type Notes string Text to use as replacement text. replace Boolean If set to , only whole words matching wholeWord true the search text are found. The default is false Finding and replacing fonts and styles Property Data type Notes string In the format:...
  • Page 25 Property Data type Notes Boolean If set to , fills that match the specified fills true colors are replaced. Boolean If set to , strokes that match the strokes true specified colors are replaced. Boolean If set to , effects that match the effects true specified colors are replaced.
  • Page 26: The Fireworks Object

    System object The following table lists the properties of the System object, along with their data types and, where appropriate, acceptable values and notes. All System properties are read-only. Property (read-only) Data type Notes string Returns the name of the operating system osName under which Fireworks is running.
  • Page 27 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 (•). For information on how to format nonstandard data types, such as rectangle or point, “Formatting nonstandard data types”...
  • Page 28 The name of the application ( appName "Fireworks ). This attribute is part of the common 8" API, so it also appears as app.appName implemented in Macromedia Dreamweaver). • string The path to the Patterns directory, which is appPatternsDir expressed as file://URL.
  • Page 29 Property Data type Notes • string The path to the Xtras directory, which is appXtrasDir expressed as file://URL. string The string that currently appears in the batchStatusString Batch Progress dialog box. Set this property to change the string being displayed. Use with progressCountCurrent progressCountTotal string...
  • Page 30 Property Data type Notes • float A fixed value of 0.55229187012 used to ellipseBCPConst calculate the distance between a point and its predecessor/successor for a perfect circle. For example, for a circle with a radius of 100 pixels, the predecessor/successor is pixels away from 100*fw.ellipseBCPConst the point itself.
  • Page 31 Property Data type Notes integer The first number (x) that appears in the progressCountCurrent Batch Progress dialog box, in the “File x of y” field. Set this property to change the number. integer The second number (y) that appears in the progressCountTotal Batch Progress dialog box, in the “File x of y”...
  • Page 32: Objects Within Fireworks Documents

    Property Data type Notes string The path to the user-level Commands userJsCommandsDir directory, which is expressed as a file:// URL. In Fireworks, this folder is stored on a per- user basis on multiuser systems. Even on single-user systems, this folder is not inside the Fireworks installation directory.
  • Page 33 Behavior object The following table lists the properties of the Behavior object, along with their data types and, where appropriate, acceptable values and notes. Property Data type Notes string The JavaScript call for the behavior. For call legal values, see “Using the dom.addBehavior() function”...
  • Page 34 Property Data type Notes string Acceptable values are feedback "none" "brush" "background" float 0 to 100 flowRate integer 0 to 64 maxCount float 0 to 100 minSize string The name of the brush, which is visible in name the Stroke panel. integer 0 to 3 numDashes...
  • Page 35 Property Data type Notes float sense_random_opacity float sense_random_saturation float sense_random_scatter float 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...
  • Page 36 Property Data type Notes float 0 to 100 textureBlend float 0 to 100 textureEdge string Acceptable values are tipColoringMode "random" "uniform" , and "complementary" "hue" "shadow" integer 1 to 32 tipCount float 0 to 100 tipSpacing string Acceptable values are tipSpacingMode "random"...
  • Page 37 ContourNode object The following table lists the properties of the ContourNode object, along with their data types and, where appropriate, acceptable values and notes. Property Data type Notes array Array of ContourNodeDynamicInfo dynamicInfo objects on this ContourNode object (for more information, see “ContourNodeDynamicInfo object”...
  • Page 38 The following table lists the methods of the ContourNode object, along with their parameters. Method Parameter Definition object The RegisterMoveParms object containing RegisterMove() the move parameters. Use smartShape.GetDefaultMoveParms() obtain this object, then adjust properties as needed. For a list of properties, see “RegisterMoveParms object”...
  • Page 39 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 float 0.0 to 65,535.0 milliseconds duration float 0.0 to 1.0 pressure float 0.0 to 255.9999 pixels per millisecond velocity ControlPoint object...
  • Page 40 The following table lists the methods of the ControlPoint object, along with their parameters. Method Parameter Definition object The RegisterMoveParms object containing RegisterMove() the move parameters. Use smartShape.GetDefaultMoveParms() obtain this object, then adjust properties as needed. For a list of properties, see “RegisterMoveParms object”...
  • Page 41 Effect object Each Fireworks Effect (bevel, drop shadow, etc.) has a unique set of attributes. So, each Effect object has its own set of properties that can be set (instead of a common set of properties for all Effect objects). The properties for various Effect objects are listed in the following tables, in alphabetical order.
  • Page 42 Property Data type Notes string EffectMoaID "{7fe61102-6ce2-11d1-8c76000502701850}" string A color string that specifies the color that is EmbossFaceColor blended onto the face of the object when embossing (for more information, see “Color string data type” on page 11). integer Specifies how far away from the object the GlowStartDistance glow starts, in pixels.
  • Page 43 Property Data type Notes float A multiplier that is used to calculate the SlopeMultiplier magnitude of the bevel slope. Default effects all use 1, but other values should work. For example, 0.5 gives a more subtle slope and 2.0 gives a sharper slope. integer SlopeType flat slope = 0...
  • Page 44 Convert to Alpha object Property Data type Notes Boolean If set to , the effect is included but EffectIsVisible false temporarily hidden. The default value is true string EffectMoaID "{2932d5a2-ca48-11d1-8561000502701850}" Curves object Property Data type Notes Boolean If set to , the effect is included but EffectIsVisible false...
  • Page 45 Find Edges object Property Data type Notes Boolean If set to , the effect is included but EffectIsVisible false temporarily hidden. The default value is true string EffectMoaID "{fc7093f1-f95c-11d0-8be200a024cdc039}" Gaussian Blur object Property Data type Notes Boolean If set to , the effect is included but EffectIsVisible false...
  • Page 46 Inner Shadow object Property Data type Notes Boolean If set to , the effect is included but EffectIsVisible false temporarily hidden. The default value is true string EffectMoaID "{5600f702-774c-11d3-baad0000861f4d01}" integer The angle of the shadow, in degrees. ShadowAngle integer The feathering amount of the shadow ShadowBlur edges, in pixels.
  • Page 47 Property Data type Notes integer These source* values are all input levels to source_low_rgb* the filter, with values of 0 to 255. source_high_rgb* source_low_red* source_high_red* source_low_green* source_high_green* source_low_blue* source_high_blue* integer These dest* values are all output levels to dest_low_rgb the filter, with values of 0 to 255. dest_high_rgb dest_low_red dest_high_red...
  • Page 48 Sharpen More object Property Data type Notes string EffectMoaID "{1f2f2591-9db7-11d1-8cad00a024cdc039}" Boolean If set to , the effect is included but EffectIsVisible false temporarily hidden. The default value is true Unsharp Mask object Property Data type Notes string EffectMoaID "{f1cfce44-718e-11d1-8c8200a024cdc039}" Boolean If set to , the effect is included but EffectIsVisible...
  • Page 49 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 string Acceptable values are blendMode "normal"...
  • Page 50 Property Data type Notes Boolean If set to , the element is hidden. The visible false default value is true • float Read-only in the base class; other width properties or API calls are used to resize specific types of elements. The following table lists the methods of the Element object, along with their parameters.
  • Page 51 Property Data type Notes string The body of code in the JavaScript file that smartShapeCode defines the Auto Shape object. string Can be one of the following: transformMode If the Auto Shape is "AlwaysTransform" transformed in any way (scale, skew, rotate) the transformation matrix is modified.
  • Page 52 Method Parameter Definition none Call this to stop receiving notification of all unRegisterAllEvents() previously registered events. string Call this to stop receiving notification of a UnRegisterForEvent() single previously registered event. Image object Image is a subclass of the base class Element (for more information, see “Element object”...
  • Page 53 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 (for more information, see “Element object” on page 49).
  • Page 54 Property Data type Notes string is set to , this text is htmlText sliceKind "empty" exported instead of the image. The default is an empty string. • string An arbitrary string that uniquely identifies sliceID this slice. string If set to , generates an image;...
  • Page 55 Text object Text is a subclass of the base class Element and contains the following properties in addition to those in Element (for more information, see “Element object” on page 49). Property Data type Notes Boolean If set to (the default), anti-aliases antiAliased true the text.
  • Page 56 Property Data type Notes float Width of the area occupied by the pixels rawWidth (not the area of the bounding box). float Height of the area occupied by the pixels rawHeight (not the area of the bounding box). Texture object The Texture object has the following read-only property.
  • Page 57 Property Data type Notes string Acceptable values are mode "mask to image" "mask to path" object The element (image, path, text, and so on) owner that owns the mask. Boolean If set to , and showAttrs true mode "mask to path" the mask element’s fill and stroke (if any) are drawn.
  • Page 58 ExportOptions object 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. Use the following information to understand the rules for determining scaling in this object: is set to (the default), is used to uniformly scale the...
  • Page 59 Property Data type Notes string Acceptable values are (the colorMode "indexed" default) , and , "24 bit" "32 bit" Boolean The default value is crop false. integer The default value is cropBottom integer The default value is cropLeft integer The default value is cropRight integer The default value is...
  • Page 60 Property Data type Notes array Array of ExportPaletteInfo objects, or paletteInfo null if all entries in the array are default values (for more information, see “ExportPaletteInfo object” on page 61); default value is null. string Acceptable values are (the paletteMode "adaptive"...
  • Page 61 ExportPaletteInfo object The following table lists the properties of the ExportPaletteInfo object, along with their data types and, where appropriate, acceptable values and notes. Property Data type Notes Boolean Set to if the color is locked in the colorLocked true panel.
  • Page 62 “HTML and Images” “Images Only” “Dreamweaver LBI” "Director HTML" "CSS Layers" "Layers to Files" "Frames to Files" "Lotus Domino" "Macromedia Flash SWF" "Illustrator" "Photoshop" string Defines the extension to append to fileExtension the filename. Boolean If set to , generates multiple HTML...
  • Page 63 Property Data type Notes through string Used to generate a name by concatenating sliceAutoNaming1 six strings. If you need fewer than six sliceAutoNaming6 strings, fill in the remaining strings with "none" Acceptable values are: — generates nothing. "none" — generates a unique row and "row_col"...
  • Page 64 Property Data type Notes string Used to generate a name by concatenating sliceFrameNaming1 two strings; the resulting string is sliceFrameNaming2 concatenated to the name specified by . If you need fewer than sliceAutoNaming two strings, fill in the remaining string with "none"...
  • Page 65 Property Data type Notes string Acceptable values are edgeType "hard" "antialiased" integer 0 to 1000, which represents the feathering feather value in pixels (0 means no feathering). object Gradient object (see “Gradient object” gradient on page 66). string The name that appears in the Fill panel. name object Pattern object (see...
  • Page 66 Property Data type Notes • array Array of FrameNLayerIntersection objects layers in the document (see FrameNLayerIntersection object on page 66). Boolean If set to , this frame is hidden. Default visible false value is true FrameNLayerIntersection object The following table lists the properties of the FrameNLayerIntersection object, along with their data types and, where appropriate, acceptable values and notes.
  • Page 67 GradientNode object The following table lists the properties of the GradientNode object, along with their data types and, where appropriate, acceptable values and notes. Property Data type Notes string A color string that specifies the color at this color position in the gradient (see “Color string data type”...
  • Page 68 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 Boolean If set to , the Layers list displays all the disclosure true...
  • Page 69 Property Data type Notes point The three properties are used fillHandle1 fillHandle by Gradient and Pattern fills to set the angle point fillHandle2 and size of the gradient/pattern. point fillHandle3 Boolean If set to , the fill is drawn on top of the fillOnTop true brush;...
  • Page 70 Property Data type Notes matrix A matrix that indicates all the transform transformations that were applied to the primitive (see “Matrix data type” on page 12). object A PathAttrs object that indicates the path pathAttributes attributes of the primitive (see “PathAttrs object”...
  • Page 71 Property Data type Notes The value to constrain the y coordinate. constrainY the method must be Note: constrainYKey used with this method. Pass in the key that you want to use to constrainYKey constrain the y-coordinate value. A value of means that y will not be constrained.
  • Page 72 Property Data type Notes float Determines the mouse radius change deltaRtoR relative to the point radius change. For example, a value of means that as the mouse moves 1 pixel away from the center of the object, the point also moves 1 pixel away from the center of the object.
  • Page 73 Property Data type Notes float The ratio of mouse movement to the deltaYtoY movement of the referenced point’s y coordinate. For example, means that when the mouse moves 1 pixel toward the bottom of the document, the referenced point also moves 1 pixel toward the bottom of the document.
  • Page 74 Property Data type Notes Boolean Determines whether the values minMaxRelative are relative or absolute. For example, if , then max.x=100 minMaxRelative true x can move up 100 points to the right. If is set to then the minMaxRelative false maximum x can be set to is 100. float The minimum value the x coordinate minX...
  • Page 75 SmartShape object The following table lists the properties of the SmartShape 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 • Boolean Indicates whether the Alt/Option key is altOptKeyDown pressed ( if pressed, otherwise...
  • Page 76 Property Data type Notes Boolean Sets live preview. A value of livePreview true enables live preview, and disables wire- frame preview handled by Fireworks. Live preview is slower than wire-frame preview. If you want the user to set this value, write a function handling the DragControlPoint message from Fireworks (see...
  • Page 77 Property (read-only) Data type Notes string A string that contains all the attributes of a tdTagText table cell except colspan rowspan Should be in a format similar to the following: "bgcolor="ff0000" valign="top"“ Boolean Whether to make the specified text bold; textBold used only if is set to...
  • Page 78 Property (read-only) Data type Notes Boolean If set to , applies the property use_textFont true textFont of the pathAttrs object when applying the style. If set to , ignores the false textFont property. The default value is false Boolean If set to , applies the property use_textSize...
  • Page 79 Property Data type Notes float Also known as pair kerning, 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 property.
  • Page 80: Html Export Objects

    TextRuns object The following table lists the properties of the TextRuns object, along with their data types and, where appropriate, acceptable values and notes. Property Data type Notes object TextAttrs object (see “TextAttrs object” initialAttrs on page 78). array Array of SingleTextRun objects on this textRuns TextRuns object (see “SingleTextRun...
  • Page 81 BehaviorInfo object The BehaviorInfo object describes a behavior that is assigned to an element. There are seven behaviors: Status Message, Swap Image, Button Down, Swap Image Restore, Button Highlight, Button Restore, and Popup Menu (new in Fireworks 4). The following table lists the properties of the BehaviorInfo object, along with their data types and, where appropriate, acceptable values and notes.
  • Page 82 Property (read-only) Data type Notes Boolean is set to 6 (Button Highlight), downHighlight action specifies if there is an image highlight for the Down button state. integer Specifies the type of event: 0 is event Mouse Over 1 is , 2 is , and 3 is On Click Mouse Out...
  • Page 83 Property (read-only) Data type Notes hiliteColor string is set to 9 (Popup Menu), specifies action the highlight color at the upper-left of the menu cells. string is set to 9 (Popup Menu), specifies menuFontFamily action the name of the font family to use for the menu.
  • Page 84 Property (read-only) Data type Notes zero-based is set to 2 (Swap Image), specifies targetFrameNum action index the frame number to be swapped if is set to hasTargetFrame true zero-based is set to 2 (Swap Image), specifies targetRowNum action index the row in the slices table that is swapped. object is set to 2 (Swap Image), specifies targetTable...
  • Page 85 BehaviorsList object The BehaviorsList object is an array of BehaviorInfo objects that describe the behaviors in an image map (see “BehaviorInfo object” on page 80). The BehaviorsList object does not occur by itself. That is, all occurrences of BehaviorsList objects are members of other objects. In the following example, is an object of type BehaviorsList, and is an...
  • Page 86 Property (read-only) Data type Notes integer A number that is assigned to a document to docID help identify HTML generated from it. The does not change when you change docID the name of a file. However, if you use File > Save As, you can get multiple files with the same docID...
  • Page 87 Property (read-only) Data type Notes Boolean Set to if the Fireworks document has a hasBackgroundLink true background URL. integer Height of the image that is being exported, height in pixels. In the Slices.htt file, it is the total height of the output images. string Determines the encoding standard for htmlEncoding...
  • Page 88 Property (read-only) Data type Notes string The HTML style that is used to export the style data, such as "Dreamweaver" "Generic" "FrontPage" string A string that contains the alignment of the tableAlignment table. If the table is left-aligned, the string is simply a space (this is used for writing the HTML table).
  • Page 89 Property (read-only) or Data type Notes Method integer Number of coordinates in the area. A circle numCoords always has 1 (the center), a rectangle has 2 (top left and bottom right), and a polygon has 1 or more. integer Radius of the area, if radius shape "circle"...
  • Page 90 SliceInfo object The following table lists the properties and methods of the SliceInfo object, along with their data types and, where appropriate, acceptable values and notes. All SliceInfo object properties are read-only. Property (read-only) or Data type Notes method string The alternate text description for this slice.
  • Page 91 Property (read-only) or Data type Notes method string Text for a text-only slice. htmlText object ImagemapList object containing the image imagemap map information for this slice (see “ImagemapList object” on page 89). string Extension for the image in this cell, imageSuffix including a period (.);...
  • Page 92: Working With Selected Objects

    Property (read-only) or Data type Notes method integer Top of the cell in pixels. The top starts at integer Width of the image in pixels, including width column spans. Slices object Slices is an object that has some properties and is also a two-dimensional array of SliceInfo objects (see “SliceInfo object”...
  • Page 93 Property (read-only) Data type Notes Boolean Set to if Export Undefined Slices is not doSkipUndefined true selected in Document Properties. string Relative URL to the images folder. For imagesDirPath example , or , "images/" "../site_images" (an empty string) if the images and the ""...
  • Page 94 You can use the information in the following sections to return or set property values. The return value for a property may be null. Working with properties for any selected object You can get values for the following read-only properties of any type of selected object: left width height...
  • Page 95 Working with specific properties for selected elements Some elements have specific properties that can be returned in addition to those that can be returned for any selected object (for more information, see “Working with properties for any selected object” on page 93).
  • Page 96 Path pathAttributes For the complete list of path attributes properties, see “pathAttributes” on page randSeed textureOffset contours To return the value of the fill color for the currently selected path, type the following code: fillColor = fw.selection[0].pathAttributes.fillColor Group elements groupType To return the number of objects in a selected group, type the following code: numOfObjectsinGroup = fw.selection[0].elements.length;...
  • Page 97 Text antiAliased antiAliasMode autoKern orientation pathAttributes For the complete list of properties, see “pathAttributes” on page pathAttributes randSeed textRuns textureOffset transformMode To return the setting for the currently selected text block, type the antiAliasMode following code: antiAliasedSetting = fw.selection[0].antiAliasMode; RectanglePrimitive Roundness pathAttributes For the complete list of path attributes properties, see...
  • Page 98 pathAttributes Several objects have the property. The following list is the valid set of pathAttributes subproperties that can be returned or set: pathAttributes brushColor fillColor brush fill brushTexture fillTexture fillHandle1 fillHandle2 fillHandle3 brushPlacement fillOnTop To return the name of brush on the current path, type the following code: brush = fw.selection[0].pathAttributes.brush.name;...
  • Page 99: 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 8 that use existing Fireworks 8 functionality. They may use JavaScript APIs for adding image-editing functionality to those applications as well as custom Fireworks panels developed in Macromedia Flash 8 to enhance the functionality of Fireworks.
  • Page 100 XML and remote procedure calls Applications written with Flash ActionScript 2.0 or C++ applications can control Fireworks 8 by sending JavaScript instructions, called remote procedure calls (RPC), encoded in XML through a local socket. The Fireworks RPC gives other applications access to functionality previously restricted to JavaScript programs running inside Fireworks.
  • Page 101 Fireworks RPC transactions pass XML between an RPC client and the Fireworks RPC server built in to Fireworks 8. 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.
  • Page 102 RPC client XML requests The XML request contains the following four pieces of information for Fireworks: The type of operation to perform The name of the operation to perform The object on which the operation is performed Any parameters the operation needs XML requests are specially formatted XML document fragments, not full XML documents.
  • Page 103 operation informs the server that the client has finished working on the release specified object. A request must specify only an attribute and no release subelements. In the following example, the client tells the server that it is has finished working on the object with ID 1: <release obj="1"...
  • Page 104 Data node The data node is the most important type of XML node in RPC. Methods called through the operation need to act on actual data or references to server objects identified in data func nodes. The data nodes are used as parameters and parts of replies. There are several types of data nodes, as described in the following table.
  • Page 105 Data Node Example Description type name null The null type has only one value: null. null <null /> The null type automatically coerces into the string type, array type, dictionary type, and the server object type. The null type cannot have any attributes or sub-elements.
  • Page 106 RPC server XML replies After the RPC server processes an XML request, it packages the result as an XML fragment and sends it back to the client. If an error occurred during processing, the server returns an error code in the result XML. Otherwise, the reply node contains a single data node with the result of the operation.
  • Page 107 Generating stubs for nonstandard client types If the client is not written in one of the languages for which Macromedia provides a client RPC library, the client implementer must create or generate the stubs. For information about how to do this, see Chapter 2, “The Fireworks Object Model,”...
  • Page 108 The following table shows the mapping between the Fireworks Object Model data types and the RPC data types. DOM data RPC data Example Description type type array array Types map identically. <array></array> Boolean Boolean Both types are identical. Both <bool value="true" /> contain only two values: true false...
  • Page 109 DOM data RPC data Example Description type type object server object, or For an object type, the client <obj value="1" /> dictionary can simply specify a server object. However, for certain objects (such as objects of the class) a dictionary can Effect be constructed and then used.
  • Page 110 113. These functions are defined in the supporting RPCMethods.as stubs file available for download from the Macromedia website at www.macromedia.com/go/fw_documentation. ActionScript remote procedure calls for Fireworks are not ActionScript 1 compatible, and must be written in ActionScript 2.0 (using Flash MX 2004 or later).
  • Page 111 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.AddToAutoReleasePool(proxyObject) Arguments proxyObject The object to add to the current pool.
  • Page 112 Description Adds an object to the current auto-release pool. This function is called by the auto-release block. If no object pool exists, this function does nothing. RPCMethods.RemoveFromAutoReleasePool() Usage RPCMethods.RemoveFromAutoReleasePool(proxyObject) Arguments proxyObject The object to remove from the current pool. Returns Nothing.
  • Page 113 To build a Flash application that uses RPC to create a Fireworks object: Download the supporting ActionScript stub files (a series of supporting ActionScript files) from the Macromedia website, you need to put them in your working directory (where the new FLA file will reside).
  • Page 114 In the first frame, add the following in the Actions panel to link the general fireworks stub file to the movie when it is published: #include "fwstubs.as" Create a simple button which will activate the RPC script. Insert the button in the first frame, in the middle of the Stage. Attach the following ActionScript code to the button to activate the RPC code when the button is clicked: on(press){...
  • Page 115: Flash Panels

    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.
  • Page 116 API wrapper MMExecute() extension for Macromedia Flash (download the API wrapper from the Macromedia website at www.macromedia.com/go/fw_documentation). You can construct these Macromedia Flash animations as interactive panels that work just as the Layers panel, the Frames panel, and other built-in panels do.
  • Page 117 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. 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...
  • Page 118 After MMExecute() MMEndCommand() it is installed, the API wrapper appears in the Macromedia Flash interface. This wrapper simplifies the writing of Fireworks commands. Instead of having to embed every Fireworks function in , you can use a series of functions in the ActionScript.
  • Page 119 Guidelines for creating panels and commands You need to surround nested quotation marks need with backslash (\). The following example prints: John’s example is really “complex”! MMExecute('alert("John\'s example is really \"complex\"!")'; The movie size set in Flash is used in Fireworks as the minimum and default size of the command panel.
  • Page 120 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).
  • Page 121 Event Description onFWDocuementOpen Sent when the document is opened. onFWDocumentClosed Sent when the document is closed. onFWDocumentSave Sent when a action is performed in the document. save onFwDocumentSizeChange Sent when the document is resized. onFwActiveViewChange Sent when the active view changes. This happens when the user changes focus in 2- or 4-Up view.
  • Page 122 Publishing When testing your script, use the File > Publish menu option in Macromedia Flash MX. The Shockwave file is in the same place as the FLA file after publishing. Debugging Fireworks provides two functions to help debug Flash panel ActionScript (for more information, see “fw.enableFlashDebugging()”...
  • Page 123: Chapter 4: Auto Shapes

    Auto Shapes are vector objects that contain information about how the user can interact with them on the screen. Auto Shapes appear in the Macromedia Fireworks 8 user interface as “Auto Shapes” but are programmatically called smartShape objects in the JavaScript code that constructs them.
  • Page 124: Creating An Auto Shape

    You can create Auto Shape icons for the Tools panel or Auto Shapes panel in PNG, JPG, or GIF format. For the Tools panel, the icon image should be 16 x 16 pixels (if the image is larger than 16 x 16 pixels, Fireworks scales the image to fit in the Tools panel). For the Auto Shapes panel, the Auto Shape icon should be 60 x 60 pixels.
  • Page 125 smartShape.elem.elements[0].contours[0].nodes[2].y = 125; smartShape.elem.elements[0].contours[0].nodes[2].succX = 200; smartShape.elem.elements[0].contours[0].nodes[2].succY = 125; smartShape.elem.elements[0].contours[0].nodes[3] = new ContourNode; smartShape.elem.elements[0].contours[0].nodes[3].predX = 0; smartShape.elem.elements[0].contours[0].nodes[3].predY = 125; smartShape.elem.elements[0].contours[0].nodes[3].x = 0; smartShape.elem.elements[0].contours[0].nodes[3].y = 125; smartShape.elem.elements[0].contours[0].nodes[3].succX = 0; smartShape.elem.elements[0].contours[0].nodes[3].succY = 125; smartShape.elem.elements[0].contours[0].isClosed = true; The Auto Shape is an array of ContourNode objects (see “ContourNode object”...
  • Page 126 Adding control points After selecting an Auto Shape in a document, the user can click its control points to adjust the object. You must define the control points for your Auto Shape before you can define what happens to the object when the user manipulates them. The following code adds a single control point to the coordinates (0, 0): smartShape.elem.controlPoints.length++;...
  • Page 127 "BeginDragControlPoint" Fireworks sends this message when the user clicks and holds the mouse button on a control point. "DragControlPoint" Fireworks sends this message every time the mouse moves during a drag operation (as long as smartshape.getsDragEvents is set to ). For more information, see “SmartShape true object”...
  • Page 128 Function Description This function is called every time the mouse moves during a drag DragInsert() operation (as long as is set to smartshape.getsDragEvents true “SmartShape object” on page 75 This function is called on a mouse-up event after a drag operation. EndDragInsert() Tells Fireworks what to do when the user clicks and holds the BeginDragControlPoint()
  • Page 129 These functions correspond directly with the messages listed in “Fireworks messages” on page 126. To invoke your own function names in response to Fireworks messages, you need to write a statement. switch() 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 statement near the switch()
  • Page 130 You can also invoke a single function for several messages: case "BeginDragInsert": case "InsertSmartShapeAt": InsertSmartShapeAt(true); break; Supporting functions and methods Because 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.
  • Page 131: Chapter 5: Fireworks Javascript Api

    CHAPTER 5 Fireworks JavaScript API This chapter lists JavaScript functions supported by Macromedia Fireworks 8 that let you 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.
  • Page 132: Document Functions

    Working with selected elements Many API functions in this chapter refer to a “selection” or to “selected items.” These terms refer to Fireworks elements, such as text boxes or images, that are currently selected. In most cases, the functions work even if only one item is selected. If a function requires more than one selected item, this is noted in the description of the function.
  • Page 133 Arguments A string that specifies the behavior to be added, such as action . For a list of all the behaviors that can be added, see “Using the "MM_swapImageRestore()" dom.addBehavior() function” on page 133. The event that triggers the behavior. Acceptable values are event "onMouseOver"...
  • Page 134 Arguments type, barName, target, swapFrame, fileName, preload Pass "down" type Pass for the name of the navigation bar. "navbar1" specifies the slice to which the behavior is attached. Pass for this value; all other target –1 values are used internally by Fireworks. is an integer value that specifies the frame to swap, starting with (although, swapFrame...
  • Page 135 is a binary value that specifies whether to preload the swapped image (pass 1) or preload not (pass is a binary value that specifies whether an image should be used for downHighlight highlighting on mouse down (pass ) or not (pass ).
  • Page 136 MM_nbGroup [out] Availability Fireworks 3. Arguments type Pass "out" 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().addBehavior("MM_simpleRollover()", "onMouseOver", -1); MM_statusMessage Availability Fireworks 3. Arguments message is a string that specifies the status message to appear.
  • Page 137 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 for this value; all target –1 other values are used internally by Fireworks. is an integer value that specifies the frame to swap, starting with (although, swapFrame to use...
  • Page 138 Example fw.getDocumentDOM().addBehavior("MM_swapImgRestore()", "onMouseOut", -1); Description Adds a swap image restore behavior. dom.addElementMask() Availability Fireworks 4. Usage dom.addElementMask(mode, {bEnterMaskEditMode}) Arguments Acceptable values for are " mode mode reveal all", "hide all", "reveal selection", . If the user is not in bitmap mode, or if there is no pixel "hide selection"...
  • Page 139 Arguments An integer that specifies how many frames to add. howMany The location where frames should be added. Acceptable values for where where , and "beginning" "before current" "after current" "end" Added in Fireworks 4, specifies whether to change the active bAdvanceActiveFrame frame.
  • Page 140 Description Adds a guide to the document. If a guide already exists at the specified position, this function has no effect. Example The following command adds a vertical guide at the x coordinate of 217: fw.getDocumentDOM().addGuide(217, "vertical"); dom.addNewHotspot() Availability Fireworks 3. Usage dom.addNewHotspot(hotspot-kind, hotspot-shape, boundingRectangle) Arguments...
  • Page 141 Arguments A rectangle that specifies the bounds of the image to be added (see boundingRectangle “Rectangle data type” on page 12). You cannot create an image that is larger than the document; therefore, if you pass in a rectangle with bounds larger than the document size, you can create an image that is constrained to the document size.
  • Page 142 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. The new image is placed directly above the active bitmap. You must have a current pixel selection for this to succeed.
  • Page 143 Example The following command adds a new unshared layer with a default name that is generated by Fireworks: fw.getDocumentDOM().addNewLayer(null, false); dom.addNewLine() Availability Fireworks 3. Usage dom.addNewLine(startPoint, endPoint) Arguments Points that specify the x,y coordinates between which the path startPoint endPoint is added (see “Point data type”...
  • Page 144 Returns Nothing. Description Adds a new oval fitting into the specified bounding rectangle. The oval uses the document’s current default path attributes and is added on the current frame and layer. Example The following command adds a new oval within the specified coordinates: fw.getDocumentDOM().addNewOval({left:72, top:79, right:236, bottom:228});...
  • Page 145 See also dom.addNewRectanglePrimitive() dom.addNewRectanglePrimitive() Availability Fireworks 4. Usage dom.addNewRectanglePrimitive(boundingRectangle, roundness) Arguments A rectangle that specifies the bounds within which the new rectangle boundingRectangle primitive is added (see “Rectangle data type” on page 12). A floating-point value between 0 and 1 that specifies the “roundness” to use for roundness the corners (0 is no roundness, and 1 is 100% roundness).
  • Page 146 dom.addNewSinglePointPath() Availability Fireworks 3. Usage dom.addNewSinglePointPath(controlPointFirst, controlPointLast, bCopyAttrs) Arguments Points that specify the x,y controlPointFirst, mjainPoint, controlPointLast coordinates of the preceding control point, the main point, and the following control point of the Bézier path (see “Point data type” on page 12).
  • Page 147 Arguments An integer that specifies the number of sides of the new path. numSides A floating-point value that controls the regularity of the star or polygon. Pass spikiness to have Fireworks calculate a good value, or pass a value between 0 and 1 for manual control. , a star with the specified number of points is created.
  • Page 148 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 to the library and places an text instance of it in the document: fw.getDocumentDOM().addNewSymbol("graphic", "text", true);...
  • Page 149 dom.addSwapImageBehaviorFromPoint() Availability Fireworks 3. Usage dom.AddSwapImageBehaviorFromPoint(where) Arguments A point that specifies the x,y coordinates of the Hotspot or slice that contains the where swap image behavior to be added (see “Point data type” on page 12). Returns if the swap image behavior was added; if no suitable Hotspot was at the true false...
  • Page 150 Specifies whether the export file size can be increased. bOkToIncreaseSize , and the current size is less than sizeInBytes , the argument bOkToIncreaseSize true increases the quality of the export settings as much as possible, making the export size larger if necessary. , the argument increases the quality of the export settings bOkToIncreaseSize false...
  • Page 151 Arguments Acceptable values are alignmode "left" "right" "top" "bottom" , and "center vertical" "center horizontal" Boolean. Determines if the alignment is to the canvas or items. The default alignToCanvas value is false Returns Nothing. Description Aligns the selection. dom.appendPointToHotspot() Availability Fireworks 3.
  • Page 152 dom.appendPointToPath() Availability Fireworks 3. Usage dom.appendPointtoPath(ontourIndex, ptToInsertBefore, controlPointFirst, mainPoint, controlPointLast) Arguments An zero-based index value that specifies the contour to which the Bézier contourIndex point is appended. For paths with multiple contours, the contours are in an arbitrary order. A zero-based index value that specifies where on the path the new point ptToInsertBefore should be placed.
  • Page 153 Arguments A point that specifies the x,y coordinates of the point to be added (see “Point data type” on page 12). A floating-point value > = 0 that specifies the tolerance between the new point tolerance and the starting point of the polyline path. If the new point is within of the tolerance starting point, the polyline path is closed.
  • Page 154 Arguments and the current fill is None, then a default fill is bNoNullFills bNoNullFills true applied instead of no fill. Returns Nothing. Description Applies the document’s current fill to the selection. Example The following command applies the current fill to the selection: fw.getDocumentDOM().applyCurrentFill(true);...
  • Page 155 dom.applyFontMarkup() Availability Fireworks 3. Usage dom.applyFontMarkup(fontAttribute, value) Arguments Acceptable values for fontAttribute fontAttribute "size" "face" must be of the form to specify a point value fontAttribute "size" value "XXXpt" size; a simple numeric value is not allowed. Returns Nothing. Description Applies the specified font markup attribute to the selected text.
  • Page 156 Example The following command applies the first style that Fireworks encounters named “Style 7”, which, in this case, is a default style: fw.getDocumentDOM().applyStyle("Style 7", 0); dom.arrange() Availability Fireworks 3. Usage dom.arrange(arrangemode) Arguments Acceptable values for arrangemode arrangemode "back" "backward" "forward" "front"...
  • Page 157 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();...
  • Page 158 dom.changeSliceGuide() Availability Fireworks MX. Usage dom.changeSliceGuide(currentPosition, newPosition, guidekind, isMagneticDrag, isSingleDrag) Arguments A floating-point value that specifies the current position of the slice currentPosition guide to be moved. A floating-point value that specifies the new position of the slice guide. newPosition Acceptable values are .
  • Page 159 dom.clearJPEGMask() Availability Fireworks 4. Usage dom.clearJPEGMask() Arguments None. 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();...
  • Page 160 dom.clipCopyAsPaths() Availability Fireworks MX. Usage dom.clipCopyAsPaths() Arguments None. Returns Nothing. Description Copies the selection to the Clipboard in Adobe Illustrator format. Example The following command copies the selected items to the Clipboard in Adobe Illustrator format: fw.getDocumentDOM().clipCopyAsPaths(); dom.clipCopyFormats() Availability Fireworks MX. Usage dom.clipCopyFormats(format) Arguments...
  • Page 161 dom.clipCut() Availability Fireworks 3. Usage dom.clipCut() Arguments None. Returns Nothing. Description Cuts the selection to the Clipboard. Example The following command cuts the selected items and places them on the Clipboard: fw.getDocumentDOM().clipCut(); dom.clipPaste() Availability Fireworks 3, updated in Fireworks 4. Usage dom.clipPaste({whatIfResolutionDifferent}, {whatIfPastingIntoElementMask}) Arguments...
  • Page 162 An optional argument, added in Fireworks 4, that whatIfPastingIntoElementMask applies only if the user is editing an element mask, and that element mask is an empty image mask. In this case, the pasted elements replace the existing mask (because it is essentially a mask that doesn’t mask anything).
  • Page 163 Acceptable values for are " " (if an maskReplaceOptions maskReplaceOptions replace element mask already exists, replace it with the pasted one), " " (if an element mask already exists, add the pasted mask to it), and " " (displays a dialog box to let the user decide).
  • Page 164 dom.clipPasteFromChannelToChannel() Availability Fireworks MX. Usage dom.clipPasteFromChannelToChannel(fromChannel, toChannel) Arguments If the current selection is not a single bitmap, a new opaque bitmap is created fromChannel and the is pasted in to all three color channels of the new bitmap, resulting in a fromChannel grayscale image.
  • Page 165 Arguments An optional string that specifies how resampling should be whatIfResolutionDifferent done if the resolution of the Clipboard contents doesn’t match the resolution of the document. Acceptable values for whatIfResolutionDifferent "resample" "do not , and (displays a dialog box to let the user decide). If resample"...
  • Page 166 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.close(bPromptToSaveChanges) Arguments , and the document was bPromptToSaveChanges bPromptToSaveChanges true changed since the last time it was saved, the user is prompted to save any changes to the document.
  • Page 167 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.convertMarqueeToPath() Availability Fireworks 7. Usage dom.convertMarqueeToPath() Arguments None. Returns Nothing. Description Converts marquee selection to path. dom.convertPathToMarquee() Availability Fireworks 7.
  • Page 168 Description Converts path to marquee selection. dom.convertToAnimSymbol() Availability Fireworks 4. Usage dom.convetToAnimSymbol(name, numFrames, offsetDistPt, rotationAmount, scaleAmount, startOpacity, endOpacity) Arguments A string that specifies a name for the new animation symbol. name An integer that specifies the number of frames through which the numFrames symbol animates.
  • Page 169 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.convertToSymbol() Availability Fireworks 3. Usage dom.convertToSymbol(type, name) Arguments Acceptable values are , and type...
  • Page 170 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 An integer that defines the width of the filter coefficients. kernelWidth An integer that defines the height of the filter coefficients.
  • Page 171 dom.copyHtmlWizard() Availability Fireworks MX. Usage dom.copyHtmlWizard() 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}, {makeRectangular}) Arguments Acceptable values are hotspotType "hotspot"...
  • Page 172 Returns Nothing. Description Creates one or more Hotspots from the selection. Example The following command adds a Hotspot to the selected item. If more than one item is selected, Fireworks creates one Hotspot for each item. fw.getDocumentDOM().copyToHotspot("hotspot", "multiple"); dom.cropSelection() Availability Fireworks 3.
  • Page 173 Returns Nothing. Description Deletes all the objects in the document. dom.deleteFrames() Availability Fireworks 3. Usage dom.deleteFrames(frameIndex, howMany) Arguments An integer value that specifies the location at which to begin deleting frames, frameIndex starting with (although, to specify the current frame, pass –1 Specifies how many frames to delete.
  • Page 174 Description Deletes a layer. Example The following command deletes the current layer: fw.getDocumentDOM().deleteLayer(-1); dom.deletePointOnPath() Availability Fireworks 4. Usage dom.deletePointOnPath(contourIndex, pointIndex) Arguments An integer value that specifies the contour that contains the point to be contourIndex deleted, starting with (although, to specify the current contour, pass here).
  • Page 175 Arguments This argument is ignored if Fireworks is not in bitmap mode. If bFillDeletedArea Fireworks is in bitmap mode and , the deleted pixels are filled bFillDeletedArea true with the current fill color. If , the deleted pixels are filled to transparent. false Returns Nothing.
  • Page 176 dom.deleteSymbol() Availability Fireworks 3. Usage dom.deleteSymbol(symbolName) Arguments The name of the symbol to delete from the library. If more than one symbol symbolName exists with this name, only the first symbol is deleted. To delete all the selected symbols from the library (not document), pass null If the deleted symbols contain any active instances in the document, the instances are also deleted.
  • Page 177 Returns Nothing. dom.detachTextFromPath() Availability Fireworks 3. Usage dom.detachTextFromPath() Arguments None. Returns Nothing. Description Splits the selected text-on-a-path items into its original text and path items. dom.distribute() Availability Fireworks 3, updated with parameter in Fireworks 8. distributeToCanvas Usage dom.distribute(distmode, distributeToCanvas) Arguments Acceptable values are distmode "vertical"...
  • Page 178 dom.distributeLayerToFrames() Availability Fireworks 3. Usage dom.distributeLayerToFrames(layerIndex) Arguments An integer value that specifies the layer that contains the items to be layerIndex distributed, starting with (although, to specify the current layer, pass here). –1 Returns Nothing. Description Distributes the items on the specified layer to the frames of the document, adding frames if necessary.
  • Page 179 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 Specifies whether the Shift key is pressed. shiftKeyDown Specifies whether the Control key (Windows) or Command key ctrlCmdKeyDown (Macintosh) is pressed.
  • Page 180 Acceptable values are where "beginning" "before current" "after , and current" "end" , only items in the specified frame bDupeSelectionOnly bDupeSelectionOnly true that are selected are duplicated to the new frame. Returns Nothing. Description Duplicates a frame. 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);...
  • Page 181 Description Duplicates a layer. Example The following command places three copies of the current layer at the end of the document: fw.getDocumentDOM().duplicateLayer(-1, 3, "end"); dom.duplicateSelection() Availability Fireworks 3. Usage dom.duplicateSelection() Arguments None. Returns Nothing. Description Makes a duplicate of the selection, offsetting it slightly from the original. Example The following command duplicates the selected items: fw.getDocumentDOM().duplicateSelection();...
  • Page 182 Arguments Integer values that specify the range of frames frameIndexFirst frameIndexLast (inclusive) to which the items should be copied, starting with (although, to specify the current frame, pass here). –1 If both arguments are the same, duplicates are placed only on that frame. If the range includes the current frame, duplicates are not placed on that frame.
  • Page 183 Arguments The symbol to duplicate. symbol To duplicate all selected symbols in the library (not the document), pass a value. null 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...
  • Page 184 Arguments Specifies which rectangle to check for elements. To find the elements under a single where 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.
  • Page 185 dom.enableTextAntiAliasing() Availability Fireworks MX. Usage dom.enableTextAntiAliasing(antiAlias) To set the level of anti-aliasing, call the function dom.setTextAntiAlisasing() (see “dom.setTextAntiAliasing()” on page 291). Arguments A Boolean value to turn anti-aliasing on ( ) or off antiAlias true (false Returns Nothing. Description Turns anti-aliasing on or off for the selected blocks of text. dom.enterElementMaskEditMode() Availability Fireworks 4.
  • Page 186 dom.enterPaintMode() Availability Fireworks 3, with the argument added in Fireworks MX. newSelectionMask Usage dom.enterPaintMode({newSelectionMask}) Arguments An optional bitmap selection mask. When is not newSelectionMask newSelectionMask null, the selection is set on the currently selected bitmap after entering paint mode. This argument is by default.
  • Page 187 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. Usage dom.exportOptions.loadColorPalette(fileURL) Arguments A string, which is expressed as a file://URL, that specifies the GIF or ACT file that fileURL is used to replace the color panel.
  • Page 188 dom.exportOptions.saveColorPalette() Availability Fireworks 3. Usage dom.exportOptions.saveColorPalette(fileURL) Arguments A string, which is expressed as a file://URL, that specifies the name of the file to fileURL which the color panel should be saved. Do not specify a file extension; the .act extension is added automatically.
  • Page 189 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 clickPt “Point data type” on page 12).
  • Page 190 dom.filterSelection() Availability Fireworks 3. usage dom.filterSelection(LiveEffect) Arguments An Effect object (see “Effect object” on page 41). LiveEffect 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.
  • Page 191 Returns Nothing. Description Applies the specified pixel filter to the selection as a permanent action, not as a Live Effect. (To apply filters that can also be Live Effects, you can use .) This dom.filterSelection() function always displays a dialog box. dom.filterSelectionByName() Availability Fireworks 3.
  • Page 192 Arguments A case-sensitive string that specifies the exact element name to find. To specify name elements that have no name, pass null Returns An array of elements that have the specified name, or if no objects have the specified null name.
  • Page 193 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.getFontMarkup(fontAttribute) Arguments Acceptable values for , and fontAttribute fontAttribute "size" "color" "face"...
  • Page 194 Returns The mask for the current pixel selection. Returns if Fireworks is not in bitmap mode, or null if there is no pixel selection. For information on the format of mask variables, see “Mask data type” on page Description Gets the current pixel-selection mask. The result of this call could be used to call “dom.enableElementMask()”...
  • Page 195 Description Determines whether the grid is visible. dom.getShowGuides() Availability Fireworks 8. Usage dom.getShowGuides() Arguments None. Returns if the guides are visible; otherwise. true false Description Determines if the guides are visible. dom.getShowRulers() Availability Fireworks 3. Usage dom.getShowRulers() Arguments None. Returns if the rulers are visible;...
  • Page 196 dom.getSnapToGuides() Availability Fireworks 8. Usage dom.getSnapToGuides() Arguments None. Returns if the Snap to Guides function is available; otherwise. true false Description Determines if the Snap to Guides function is available. dom.getSnapToGrid() Availability Fireworks 3. Usage dom.getSnapToGrid() Arguments None. Returns if the Snap to Grid function is active; otherwise.
  • Page 197 Arguments None. Returns One of the following strings: "left" "center" "right" "justify" "stretch" , or "vertical left" "vertical center" "vertical right" "vertical justify" . Returns if the text has multiple alignments or if the selection "vertical stretch" null contains no text. Description Gets the alignment of selected text.
  • Page 198 dom.hasCharacterMarkup() Availability Fireworks 3, updated in Fireworks 4. Usage dom.hasCharacterMarkup(tag) Arguments Acceptable values are , and , for bold, italic, and underline; and "b" "i" "u" "fwplain" which was added in Fireworks 4, for text without character markup. Returns if the text has the specified character markup; if it does not or if only part of the true false...
  • Page 199 dom.importFile() Availability Fireworks 3. Usage dom.importFile(fileURL, boundingRectangle, bMaintainAspectRatio) Arguments The filename of the file to be imported, which is expressed as a file://URL. fileURL A rectangle that specifies the size to make the imported file (see boundingRectangle “Rectangle data type” on page 12).
  • Page 200 Arguments The name of the file to be imported into the library, which is expressed as a file:// fileURL URL. , the symbol is added to the library and an instance of the bAddToDoc bAddToDoc true symbol is inserted into the center of the document. If it is , the symbol is added only to false the library.
  • Page 201 This function is similar to the API. places an dom.importSymbol dom.importSymbol instance of a symbol in your document—for example, when you select Edit > Libraries > Buttons, and extracts the component elements from the dom.importSymbolButNotAsAlias selected symbol and places copies of those elements in the document. does not place in an instance in the document.
  • Page 202 A floating-point value between 0 and 1 that specifies where to insert the new tParameter point in the Bézier segment. , and Points that specify the x,y controlPointFirst, mainPoint controlPointLast coordinates of the preceding control point, the main point, and the following control point of the new point (see “Point data type”...
  • Page 203 dom.insertSymbolAt() Availability Fireworks 8. Usage dom.insertSymbolAt(uiName, locationPoint) Arguments The name of the symbol in the library. If more than one symbol exists with the uiName specified name, Fireworks inserts the first symbol named. The center of the symbol expressed as x, y coordinates. locationPoint Returns Nothing.
  • Page 204 dom.joinPaths() Availability Fireworks 3. Usage dom.joinPaths() Arguments None. Returns Nothing. Description Joins the selected paths. dom.knifeElementsFromPoint() Availability Fireworks 3. Usage dom.knifeElementsFromPoint(from, tolerance) Arguments A point that specifies the x,y coordinates of the point that the user clicked (see “Point from data type”...
  • Page 205 dom.knifeElementsFromPoints() Availability Fireworks 3. Usage dom.knifeElementsFromPoints(from, to, tolerance) Arguments A point that specifies the x,y coordinates of the point where the user clicked and from started to drag (see “Point data type” on page 12). A point that specifies the x,y coordinates of the point where the user ended the drag operation.
  • Page 206 An integer value that specifies the element, starting with (although, to specify element the current element, pass here). –1 , the element masks are linked to their elements; if , they are bLink bLink true false unlinked from their elements. Returns Nothing.
  • Page 207 Returns A Find object. Description Creates an object of class Find to perform a search-and-replace operation in a document. 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...
  • Page 208 Description Merges selected objects to the bitmap directly below the selected objects. Succeeds only if the object immediately below the selection is a bitmap. For more information, see “dom.isSelectionDirectlyAboveBitmapObject()” on page 203. dom.modifyPointOnPath() Availability Fireworks 3. Usage dom.modifyPointOnPath(ontourIndex, ptToModify, controlPointFirst, mainPoint, controlPointLast, dReapplyAttrs, bClosePath) Arguments A zero-based index that specifies the contour into which the Bézier point is...
  • Page 209 Arguments A string that specifies the type of blur to apply. Valid values are typeStr "linear" , and "radial" "zoom" An integer between 0 and 359 that specifies in degrees the direction of the blur, angle similar to the drop shadow effect angle. A floating-point value between 0 and 400 that specifies in pixels how far from the distance original image the blur effect will extend.
  • Page 210 Returns Nothing. Description Moves the specified point’s Bézier handles by a certain amount. dom.moveElementMaskBy() Availability Fireworks 4. Usage dom.moveElementMaskBy(delta) Arguments A point that specifies the x,y coordinate values by which the element masks are delta moved (see “Point data type” on page 12).
  • Page 211 Specifies which handle to move and can be one of the following values: whichHandle , or . (Some fills ignore .) Use "start" "end1" "end2" "rotate1" "rotate2" "end2" to rotate the point around the start point. "rotate1" "rotate2" end1 end2 If the value of , movement is constrained to 45º...
  • Page 212 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 delta moved (see “Point data type” on page 12). For example, passing ({ })moves the bitmap mode selection 1 pixel to the right and 2 pixels down. Returns Nothing.
  • Page 213 dom.movePointOnHotspotByWithFlags() Availability Fireworks MX. Usage dom.MovePointOnHotspotByWithFlags(ptToModifyIndex, delta, flags) Arguments A zero-based index that specifies which point on the path is to move. ptToModifyIndex A point that specifies the x-,y-coordinate values by which the point is moved (see delta “Point data type” on page 12).
  • Page 214 Description If the selection contains at least one path with at least one Bézier point selected, this function moves all selected Bézier points on all selected paths by the specified amount. 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 delta “Point data type”...
  • Page 215 Arguments A point that specifies the x-,y-coordinate values by which the mask is moved (see delta “Point data type” on page 12). For example, passing moves the mask 1 pixel to the right and 2 pixels down. Returns Nothing. Description Moves the current pixel mask by the specified amount.
  • Page 216 dom.moveSelectionToFrame() Availability Fireworks 3. Usage dom.moveSelectionToFrame(frameIndex, bMakeCopy) Arguments An integer value that specifies the frame to which the selection is moved or frameIndex copied, starting with 0 (although, to specify the current frame, pass here). –1 , the selection is copied instead of moved. bMakeCopy bMakeCopy true...
  • Page 217 A zero-based index, added in Fireworks 4, that specifies the element before elementIndex which the moved or copied selection should be inserted. If is omitted, the elementIndex selection is placed at the top of the layer (before any other elements). Otherwise, it is an index within the existing elements in the layer, where is the topmost, and ( ) is the last element...
  • Page 218 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 miter pixels.
  • Page 219 Acceptable values are , and join "bevel" "round" "miter" Returns Nothing. Description Performs an inset operation on the selected paths. dom.pathIntersect() Availability Fireworks 3. Usage dom.pathIntersect() Arguments None. Returns Nothing. Description Performs an intersect operation on the selected paths. dom.pathPunch() Availability Fireworks 3.
  • Page 220 dom.pathSimplify() Availability Fireworks 3. Usage dom.pathSimplify(limit) Arguments is a floating-point value that specifies how much to simplify. This value corresponds to limit 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.
  • Page 221 dom.previewInBrowser() Availability Fireworks MX. Usage dom.previewInBrowser(primaryBrowser) Arguments A Boolean value that specifies which browser Fireworks should start: the primaryBrowser primary browser ( ) or the secondary browser ( true false Returns Nothing. Description Previews the document in the primary or secondary browser. dom.rebuildColorTable() Availability Fireworks 3.
  • Page 222 dom.redo() Availability Fireworks 3. Usage dom.redo() Arguments None. Returns Nothing. Description Reinstates the last action that was undone in the document. dom.redraw() Availability Fireworks MX. Usage dom.redraw() Arguments None. Returns Nothing. Description Forces the document to redraw itself immediately. This function is useful for providing feedback during complicated commands.
  • Page 223 dom.redrawSmartShape() Availability Fireworks 8. Usage dom.redrawSmartShape() Arguments None. Returns Nothing. Description Forces the Auto Shapes in the document to redraw. This method is useful when modifying a Auto Shape outside a tool. dom.reflectSelection() Availability Fireworks 3. Usage dom.reflectSelection(bHoriz, bVert, opts) Arguments , the items are reflected horizontally.
  • Page 224 dom.removeAllGuides() Availability Fireworks 3. Usage dom.removeAllGuides(guidekind) Arguments Acceptable values are guidekind "horizontal" "vertical" Returns Nothing. Description Removes all guides of the specified type. dom.removeBehavior() Availability Fireworks 3. Usage dom.removeBehavior({event}, {eventIndex}) Arguments An optional argument specifying the event that triggers the behavior. This argument event is ignored by Fireworks.
  • Page 225 Description Removes one or all behavior events from the selected Hotspots and slices. See also dom.addBehavior() dom.removeBrush() Availability Fireworks 3. Usage dom.removeBrush() Arguments None. Returns Nothing. Description Sets the brush of the selection to None. dom.removeCharacterMarkup() Availability Fireworks 3. Usage dom.removeCharacterMarkup(tag) Arguments Acceptable values are...
  • Page 226 dom.removeElementMask() Availability Fireworks 4. Usage dom.removeElementMask(whatIfElementIsAnImage) Arguments This argument is used only if the element (not the element whatIfElementIsAnImage mask) is an image. Acceptable values for (apply the whatIfElementIsAnImage "apply" element mask to the image before discarding the element mask), (discard the "discard"...
  • Page 227 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 A floating-point value that specifies the position of the guide to be removed. position Acceptable values are .
  • Page 228 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 A zero-based index that specifies which frame to move or copy. frameToMove A zero-based index that specifies where to place the frame that is to frameToPutItBefore...
  • Page 229 Example The following command moves the third frame before the first frame: fw.getDocumentDOM().reorderFrame(2, 0, false); 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 A zero-based index that specifies where to place the layer to be layerToPutItBefore moved or copied.
  • Page 230 Returns Nothing. Description Replaces all text items (selected and unselected) within the document that are defined as Button Text items with the specified string. (Button Text items are defined as the topmost text items on each frame.) See also dom.replaceButtonTextStringsInInstances() dom.replaceButtonTextStringsInInstances() Availability Fireworks 3.
  • Page 231 dom.replaceTextString() Availability Fireworks 3. Usage dom.replaceTextString(newString, uniformAttrs) Arguments Specifies the string to be used as replacement text. newString , each character retains the attributes of the uniformAttrs uniformAttrs false character that was formerly in its position; that is, Fireworks preserves the existing formatting. , all characters assume the attributes of the first character in the string uniformAttrs true...
  • Page 232 dom.restoreJPEGMask() Availability Fireworks 4. Usage dom.restoreJPEGMask() Arguments None. Returns Nothing. Description Restores the selection that is specified in dom.saveJPEGMask(). See also dom.saveJPEGMask() dom.restoreSelection() Availability Fireworks 4. Usage dom.restoreSelection(selectionName, fromDocument, {operation}, {invert}) Arguments User-specified name of the selection to restore. If selection name is not selectionName specified, the selection named will be restored.
  • Page 233 Returns if the selection is inverted; otherwise true false 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.
  • Page 234 Description Rotates the entire document 90º, 180º, or 270º clockwise. Rotating 270º is the same behavior as rotating 90º counterclockwise. dom.rotateSelection() Availability Fireworks 3. Usage dom.rotateSelection(rotationDegrees, opts) Arguments A floating-point value that specifies the number of degrees to rotate rotationDegrees the selection.
  • Page 235 Description Saves the document in its default location. After a successful save operation, the document’s property is cleared. isDirty 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 fileURL under which the copy should be saved.
  • Page 236 Description Stores the current selection in bitmap mode as the “Selective JPEG mask”. Use to restore the JPEG mask. dom.restoreJPEGMask() See also dom.restoreJPEGMask() dom.saveSelection() Availability Fireworks 4. Usage dom.saveSelection({selectionName}, {toDocument}, {operation}) Arguments User-specified name of the selection to save. This parameter is optional. If selectionName is not specified, Fireworks will save the selection with the name selectionName...
  • Page 237 dom.scaleSelection() Availability Fireworks 3. Usage dom.scaleSelection(xScaleAmount, yScaleAmount, opts) Arguments Float values that specify the amount to scale the xScaleAmount yScaleAmount selection in the horizontal and vertical axes. Acceptable values are 0.0 or greater; a value of 1 represents 100%, 2 represents 200%, and so on. Acceptable values are , and opts...
  • Page 238 Arguments Acceptable values are , and whatToDo "expand" "contract" "border" "smooth" to expand the pixel selection outward by the number of pixels that are "expand" specified by amount to reduce the pixel selection inward by the number of pixels that are "contract"...
  • Page 239 dom.selectAllOnLayer() Availability Fireworks MX. Usage dom.selectAllOnLayer(layerIndex, bRememberSelection, bToggleSelection) Arguments A long integer that identifies the layer on which to select the element. layerIndex A Boolean value. If , all the elements on the layer are appended bRememberSelection true to the current selection. A Boolean value.
  • Page 240 See also dom.selectParents() dom.selectFeather() Availability Fireworks 3. Usage dom.selectFeather(featherAmount) Arguments An integer that specifies the number of pixels by which to feather the featherAmount selection. Returns Nothing. Description If Fireworks is in bitmap mode and a pixel selection is active, this function feathers the selection by the specified number of pixels.
  • Page 241 dom.selectNone() Availability Fireworks 3. Usage dom.selectNone() Arguments None. Returns Nothing. Description Deselects any selected items. If Fireworks is in image edit mode, has a pixel selection, and has a Selection tool selected, then this function deselects the pixels and exits image edit mode. dom.selectParents() Availability Fireworks 3.
  • Page 242 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 tolerance selecting pixels. Acceptable values are , and edgemode "hard edge" "antialias" "feather" An integer that specifies the number of pixels to feather. This value is ignored featherAmt is not edgemode...
  • Page 243 Arguments A point that specifies the x,y coordinates of the pixel whose color is used to calculate where the new mask (see “Point data type” on page 12). An integer between 0 and 255, inclusive, that specifies the tolerance for tolerance selecting pixels.
  • Page 244 Example The following example opens a new e-mail in the default e-mail program and attaches the file foo.png to the message: fw.getDocumentDOM().sendEmail("file:///Users/andy/Documents/foo.png"); dom.setAllLayersDisclosure() Availability Fireworks 4. Usage dom.setAllLayersDisclosure(bDisclosed) Arguments , all the elements on all layers appear in the Layers list. If bDisclosed bDisclosed true...
  • Page 245 Returns Nothing. Description Sets the loop count of the selected instances of multiframe image symbols. dom.setAnimInstanceNumFrames() Availability Fireworks 4. Usage dom.setAnimInstanceNumFrames(numFrames) Arguments An integer that specifies the number of frames through which the symbol numFrames animates. Returns Nothing. Description Sets the number of frames to animate the currently selected animation element. See also dom.convertToAnimSymbol() dom.setAnimInstanceOffsetDist()
  • Page 246 Returns Nothing. Description Sets the distance, in pixels, to animate the currently selected animation element. See also dom.convertToAnimSymbol() dom.setAnimInstanceRotationAmount() Availability Fireworks 4. Usage dom.setAnimInstanceRotationAmount(rotationAmount) Arguments A floating-point value that specifies the degree of rotation to be applied to rotationAmount the animation symbol. For example, passing specifies an animation that does two complete clockwise rotations.
  • Page 247 Arguments A positive floating-point value that specifies the amount of scaling to be scaleAmount applied to the animation symbol. For example, pass to scale the symbol to 50% of its current size, and pass to scale it to twice its current size. To specify no scaling, pass Returns Nothing.
  • Page 248 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 startFrame Objects panel when a multiframe image instance is selected. Returns Nothing.
  • Page 249 dom.setBrush() Availability Fireworks 3. Usage dom.setBrush(brush) Arguments A Brush object (see “Brush object” on page 33). brush 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 A color string (see “Color string data type”...
  • Page 250 dom.setBrushName() Availability Fireworks 3. Usage dom.setBrushName(category, currentName, newName) Arguments A string that specifies the category of the brush to be renamed. category A string that specifies the current name of the brush. currentName A string that specifies the new name of the brush. newName Returns Nothing.
  • Page 251 dom.setBrushNColorNTexture() Availability Fireworks 3. Usage dom.setBrushNColorNTexture(brush, color, texture-name) Arguments A Brush object (see “Brush object” on page 33). brush A color string (see “Color string data type” on page 11). color The name of the texture to be applied. texture-name Returns Nothing.
  • Page 252 dom.setButtonAutoSlice() Availability Fireworks 3. Usage dom.setButtonAutoSlice(bAutoSlice) Arguments , automatic slicing is turned on. If bAutoSlice bAutoSlice true bAutoSlice 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.
  • Page 253 dom.setButtonIncludeOverWhileDownState() Availability Fireworks 3. Usage dom.setButtonIncludeDownState(bIncludeOverWhileDownState) Arguments , the Over- bIncludeOverWhileDownState bIncludeOverWhileDownState true While-Down state is included in the button. If , it is bIncludeOverWhileDownState false not. Returns Nothing. Description If the user edits a Button document, this function specifies whether to include the Over- While-Down state in a button.
  • Page 254 dom.setButtonOptions() Availability Fireworks 3. Usage dom.setButtonOptions(exportOptions, URLString, altTagString, targetTagString, sliceName, statusMessage) Arguments An ExportOptions object (see “ExportOptions object” on page 58). exportOptions A string that specifies the URL for the button(s). URLString Specify the text for the button alt tag and target tag. altTagString targetTagString A string that specifies the name to be assigned to the slice that is associated with...
  • Page 255 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.setDocumentCanvasColor(color) Arguments A color string (see “Color string data type”...
  • Page 256 dom.setDocumentCanvasSize() Availability Fireworks 3. Usage dom.setDocumentCanvasSize(boundingRectangle) Arguments A rectangle that specifies the new canvas size for the document, boundingRectangle in pixels (see “Rectangle data type” on page 12). Any items outside the specified rectangle are removed. Returns Nothing. Description Sets the document’s canvas size to the specified rectangle. Example The following command sets the canvas to a size of 200 by 200 pixels: fw.getDocumentDOM().setDocumentCanvasSize({left:150, top:150, right:350,...
  • Page 257 Description Calculates the size of all the items in the document and resizes the document canvas to that size. This action is the same behavior as Modify > Trim Canvas. Example The following command resizes the canvas to include all the items in the document, enlarging the canvas if necessary: fw.getDocumentDOM().setDocumentCanvasSizeToDocumentExtents(true);...
  • Page 258 Arguments A rectangle that specifies the size to which the document should be boundingRectangle scaled (see “Rectangle data type” on page 12). Specifies the resolution for the scaled document (see “Resolution data type” resolution on page 12). Returns Nothing. Description Scales the document to fit in the specified rectangle at the specified resolution.
  • Page 259 Arguments A string that defines the name of the category of the effect. category The existing name of the effect. oldName The new name to give to the effect. newName Returns Nothing. Description Sets the name for the current effect. dom.setElementLocked() Availability Fireworks 8.
  • Page 260 dom.setElementLockedByName() Availability Fireworks 8. Usage dom.setElementLockedByName(name, bLock) Arguments A string that specifies the name of the element or elements to be locked or unlocked. If name more than one element has the same name, the function locks or unlocks all of them. A Boolean value.
  • Page 261 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.
  • Page 262 Description Sets the name of the selected element(s). See also dom.findNamedElements() 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 frameIndex shown or hidden, starting with (although, to specify the current frame, pass here).
  • Page 263 dom.setElementVisibleByName() Availability Fireworks 4. Usage dom.setElementVisibleByName(name bShow) Arguments A string that specifies the name of the element(s) to be shown or hidden. If more than name one element has the same name, this function shows or hides all of them. , the elements are visible.
  • Page 264 dom.setExportSettings() Availability Fireworks 3. Usage dom.setExportSettings(exportSettings) Arguments An ExportSettings object (see “ExportSettings object” on page 61). exportSettings Returns Nothing. Description Sets the document export settings. dom.setFill() Availability Fireworks 3. Usage dom.setFill(fill) Arguments A Fill object (see “Fill object” on page 64).
  • Page 265 Arguments A color string (see “Color string data type” on page 11). color Returns Nothing. Description Changes the fill color of the selection to the specified color. dom.setFillEdgeMode() Availability Fireworks 3. Usage dom.setFillEdgeMode(edgemode, featherAmt) Arguments Acceptable values are , and edgemode "hard edge"...
  • Page 266 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 A Fill object (see “Fill object” on page 64). fill A color string (see “Color string data type” on page 11).
  • Page 267 dom.setFillPlacement() Availability Fireworks 3. Usage dom.setFillPlacement(placement) Arguments Acceptable values are placement "top" "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 , and Points that specify the x,y coordinates of the three points used to calculate the fill vector (see “Point data type”...
  • Page 268 dom.setFillVectorStart() Availability Fireworks 3. Usage dom.setFillVectorStart(p1) Arguments A point that specifies the x,y coordinates of the fill start point (see “Point data type” on page 12). 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.
  • Page 269 dom.setGridOrigin() Availability Fireworks 3. Usage dom.setGridOrigin(gridOrigin) Arguments A point that specifies the x,y coordinates of the document’s grid origin (see gridOrigin “Point data type” on page 12). Returns Nothing. Description Sets the grid origin for the document. dom.setGridSize() Availability Fireworks 3. Usage dom.setGridSize(gridSize) Arguments...
  • Page 270 dom.setGridColor() Availability Fireworks 3. Usage dom.setGridColor(gridColor) Arguments A color string (see “Color string data type” on page 11). gridColor Returns Nothing. Description Sets the color used to display the grid. dom.setGroupType() Availability Fireworks 3, arguments deprecated in Fireworks 4. Usage dom.setGroupType({type}) Arguments An optional string that specifies how to group the items.
  • Page 271 dom.setGuideColor() Availability Fireworks 3. Usage dom.setGuideColor(guideColor) Arguments A color string (see “Color string data type” on page 11). guideColor Returns Nothing. Description Sets the color that is used to display normal (nonslice) guides. To set the color of slice guides, dom.setSliceGuideColor().
  • Page 272 Example The following command sets the text attributes of the alt tag of the selected slices to " This is ": my alt tag fw.getDocumentDOM().setHotspotAltTag("slices","This is my alt tag"); dom.setHotspotColor() Availability Fireworks 3. Usage dom.setHotSpotColor(whatToSet, color) Arguments Acceptable values are , and whatToSet "hotspots"...
  • Page 273 A Boolean value; if it is , the selection is copied and resized instead of bMakeCopy true moved and resized. Returns Nothing. Description If the selection is a single Hotspot or slice, this function moves or copies it to the specified location at the specified size.
  • Page 274 Returns Nothing. Description Sets the target tag text to the specified value for the Hotspots and slices in the selection. Example The following command links the currently selected slices to the parent window: fw.getDocumentDOM().setHotspotTarget("slices", "_parent"); dom.setHotspotText() Availability Fireworks 3. Usage dom.setHotspotText(whatToSet, textString, urlToMatch, bUpdateAttributes) Description Sets the Hotspot text to the specified value for the Hotspots and slices in the selection.
  • Page 275 Description Sets the Hotspot text to the specified value for the Hotspots and slices in the selection. Example The following command creates a slice and inserts the HTML text, "I am HTML text" fw.getDocumentDOM().setHotspotText("Slice ","I am HTML text", null, true); dom.setLayerDisclosure() Availability Fireworks 4.
  • Page 276 Arguments An integer value that specifies the layer to be locked or unlocked, starting with layerIndex (although, to specify the current layer, pass here). To lock or unlock all the layers on a –1 frame, use the argument. bAllLayers An integer value that specifies the frame that contains the layer that is to be frameIndex locked or unlocked, starting with (although, to specify the current frame, pass...
  • Page 277 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 layerIndex with (although, to specify the current layer, pass here). –1 Acceptable values are sharedStatus "shared" "not shared"...
  • Page 278 Arguments An integer value that specifies the layer that should be shown or hidden, layerIndex starting with (although, to specify the current layer, pass here). To show or hide all the –1 layers on a frame, use the argument. bAllLayers An integer value that specifies the frame that contains the layer to be shown or frameIndex hidden, starting with...
  • Page 279 Example The following command sets the matte color to blue: fw.getDocumentDOM().setMatteColor(true, "#0033ff"); dom.setPixelMask() Availability Fireworks 3, deprecated in 4 in favor of dom.setSelectionMask() Usage dom.setPixelMask(mask, howToCombineMasks) Arguments A mask variable that specifies the mask to be applied (see “Mask data type” mask on page 11).
  • Page 280 Arguments Integers that specify the number of frames to display before and after the before after current one. To disable onion skinning, pass for both arguments. To enable onion skinning for all frames, pass and a large number (for example, ) for before 99,999...
  • Page 281 dom.setQuadrangle() Availability Fireworks 3. Usage dom.setQuadrangle(pTopLeft, pTopRight, pBottomRight, pBottomLeft, options) Arguments Relative coordinates of a pTopLeft, pTopRight, pBottomRight, pBottomLeft quadrangle expressed as percentages of an arbitrary square. These are not specific x, y coordinates. Acceptable values are , and options "transformAttributes"...
  • Page 282 Arguments A floating-point value between 0 and 1 that specifies the roundness to use for roundness the corners ( is no roundness, is 100% roundness). Returns Nothing. Description Modifies the corner roundness of all the selected rectangle primitives. See also dom.addNewRectanglePrimitive(), dom.setRectSides() dom.setRectSides()
  • Page 283 dom.setSelectionBounds() Availability Fireworks 3. Usage dom.setSelectionBounds(boundingRectangle, opts) Arguments A rectangle that specifies the new location and size of the selection (see boundingRectangle “Rectangle data type” on page 12). Acceptable values are , and opts "transformAttributes" "autoTrimImages" "autoTrimImages transformAttributes" Returns Nothing. Description Moves and resizes the selection in a single operation.
  • Page 284 Description If Fireworks is in bitmap mode, this function sets the pixel-selection mask of the current image to the specified mask. dom.setShowEdges() Availability Fireworks 3. Usage dom.setShowEdges(bShowEdges) Arguments , the Show Edges option is turned on. If bShowEdges bShowEdges true bShowEdges , the option is turned off.
  • Page 285 dom.setShowGrid() Availability Fireworks 3. Usage dom.setShowGrid(bShow) Arguments , the grid is visible. If , it is not visible. bShow bShow true bShow false Returns Nothing. Description Specifies whether the grid is visible. dom.setShowGuides() Availability Fireworks 3. Usage dom.setShowGuides(bShow) Arguments , the normal guides are visible. If , they are not visible.
  • Page 286 Arguments , the rulers are visible. If , they are not visible. bShow bShow true bShow false Returns Nothing. Description Specifies whether rulers are visible. dom.setShowSliceGuides() Availability Fireworks 3. Usage dom.setShowSliceGuides(bShow) Arguments , the slice guides are visible. If , they are not visible. bShow bShow true...
  • Page 287 Description Specifies whether the slice overlay is visible. dom.setSliceAutonaming() Availability Fireworks 3. Usage dom.setSliceAutonaming(bAutoname) Arguments , automatic naming is turned on for the slice. If bAutoname bAutoname true bAutoname , it is turned off. false Returns Nothing. Description If a single slice is selected, this function turns automatic naming on or off for the slice. dom.setSliceExportOptions() Availability Fireworks 3.
  • Page 288 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 If a single slice is selected, this function turns off automatic naming for the slice and sets its filename to the specified URL.
  • Page 289 dom.setSliceHtml() Availability Fireworks 3. Usage dom.setSliceHtml(htmlText) Arguments A string that specifies the HTML text for the slice. htmlText Returns Nothing. Description If a single slice is selected, this function sets the slice’s HTML text. dom.setSliceIsHtml() Availability Fireworks 3. Usage dom.setSliceIsHtml(bHtml) Arguments , sets the slices as HTML.
  • Page 290 Arguments , the tools snap to the grid. If , they do not. bSnap bSnap true bSnap false Returns Nothing. Description Specifies whether tools snap to the grid. dom.setSnapToGuides() Availability Fireworks 3. Usage dom.setSnapToGuides(bSnap) Arguments , the tools snap to all guides. If , they do not.
  • Page 291 Specifies the new name for the symbol. newName Returns Nothing. Description Sets the name and symbol type of the specified symbol. dom.setTextAlignment() Availability Fireworks 3. Usage dom.setTextAlignment(alignment) Arguments Acceptable values alignment alignment "left" "center" "right" "justify" "stretch" "vertical left" "vertical center" "vertical right"...
  • Page 292 Description Sets the anti-aliasing level for the selected blocks of text. To turn anti-aliasing on or off, call dom.enableTextAntiAliasing. See also dom.enableTextAntiAliasing() dom.setTextAutoKern() Availability Fireworks 3. Usage dom.setTextAutoKern(bKern) Arguments , automatic kerning is on for the selected text items. If bKern bKern true...
  • Page 293 Returns Nothing. Description Adjusts the kerning of text. dom.setTextCustomAntiAliasOverSample() Availability Fireworks MX 2004. Usage dom.setTextCustomAntiAliasOverSample(overSample) Arguments The integer 4, 8 or 16 that specifies the amount of oversampling used to anti- overSample alias text in custom mode. Returns Nothing. Description Sets the oversampling used to anti-alias text in custom mode.
  • Page 294 dom.setTextCustomAntiAliasStrength() Availability Fireworks MX 2004. Usage dom.setTextCustomAntiAliasStrength(strength) Arguments An integer value, from 0 to 255, for the amount of anti-aliasing to apply. Strength Returns Nothing. Description Sets the strength value used to anti-alias text in custom mode. dom.setTextFlow() Availability Fireworks 3. Usage dom.setTextFlow(flowDirection) Arguments...
  • Page 295 Arguments A floating-point number that describes how much to scale the text characters horizScale horizontally. A value of is normal. Values greater than make the characters wider, and values less than make the characters narrower. Returns Nothing. Description Sets the horizontal scaling of text. For vertical text mode, this function stretches or compresses the height of the characters.
  • Page 296 dom.setTextOnPathMode() Availability Fireworks 3. Usage dom.setTextOnPathMode(mode) Arguments Acceptable values are , and mode "rotate" "vertical" "skew vertical" "skew horizontal" Returns Nothing. Description Determines how the selected text-on-a-path items are displayed. dom.setTextOnPathOffset() Availability Fireworks 3. Usage dom.setTextOnPathOffset(offset) Arguments A floating-point value that specifies the offset distance, in pixels. offset Returns Nothing.
  • Page 297 dom.setTextOrientation() Availability Fireworks 3. Usage dom.setTextOrientation(orientation) Arguments Acceptable values are orientation "horizontal left to right" "vertical right to , and left" "horizontal right to left" "vertical left to right" Returns Nothing. Description Sets the horizontal/vertical text orientation of the selected text items. dom.setTextParaIndent() Availability Fireworks MX.
  • Page 298 dom.setTextParaSpacingAfter() Availability Fireworks MX. Usage dom.setTextParaSpacingAfter(paraSpaceAfter) Arguments The number of pixels to place after a paragraph before starting the paraSpaceAfter next paragraph. Returns Nothing. Description Sets the after-paragraph spacing for text; that is, the number of pixels to move down before starting the next paragraph.
  • Page 299 dom.setTextRuns() Availability Fireworks 3. Usage dom.setTextRuns(textRuns) Arguments A TextRuns object (see “TextRuns object” on page 80). textRuns Returns Nothing. Description Replaces the text in the selected text blocks with the styled text that is described by the TextRuns object passed in the argument. dom.setTransformMode() Availability Fireworks 3.
  • Page 300 dom.setTextRectangle() Availability Fireworks 3. Usage dom.setTextRectangle(boundingRectangle) Arguments A rectangle that specifies the new size within which the text item boundingRectangle should flow (see “Rectangle data type” on page 12). Returns Nothing. Description Changes the bounding rectangle of the selected text item to the specified size. This function causes the text to reflow inside the new rectangle;...
  • Page 301 dom.setTextRectangleAutoFromPoint() Availability Fireworks 3. Usage dom.setTextRectangleAutoFromPoint(anchorPoint) Arguments A point that specifies the x,y coordinates of the location at which the text box anchorPoint should be anchored (see “Point data type” on page 12). How the point is used depends on the left-to-right and up-to-down orientation of the text flow in the text block.
  • Page 302 Returns Nothing. Description Shows all the items that were hidden through dom.hideSelection() See also dom.hideSelection() 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...
  • Page 303 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, updated in Fireworks 4. Usage dom.transformSelection(matrix, options) Arguments A three-by-three transformation matrix (see “Matrix data type” on page 12).
  • Page 304 Returns Nothing. Description Tweens between the two selected instances. dom.undo() Availability Fireworks 3. Usage dom.undo() Arguments None. Returns Nothing. Description Undoes the most recent step performed, as long as that step is actually undoable; meaning, if you use a command that contains multiple JavaScript instructions, then you can undo the command (all 10 JavaScript instructions) and not just one JavaScript instruction within that command.
  • Page 305: Fireworks Functions

    Returns Nothing. Description Updates the specified linked symbol. dom.ungroup() Availability Fireworks 3. Usage dom.ungroup() Arguments None. Returns Nothing. Description Ungroups any grouped items in the selection. To group items, use dom.group() See also dom.group() Fireworks functions In Fireworks MX, is synonymous with the Fireworks object All methods of the Fireworks object can be referred to as or as...
  • Page 306 . The first two values browseType "open" "select" "save" display an Open dialog box; each is acceptable for compatibility with Macromedia Dreamweaver. The third value displays a Save dialog box. Ignored by Fireworks but are accepted for compatibility title previewArea with Dreamweaver.
  • Page 307 Arguments An optional string that specifies a title for the dialog box that appears. If it is omitted title , a default title appears. null An optional string that serves as the root directory for the dialog box that startFolder appears.
  • Page 308 Returns Nothing. Description Checks the JavaScript API for incompatibilities. fw.chooseBrowser() Availability Fireworks MX. Usage fw.chooseBrowser(primaryBrowser) Arguments A Boolean value that indicates which browser to select. If primaryBrowser , Fireworks prompts the user to set the primary browser; if the primaryBrowser true argument is , Fireworks prompts the user to set the secondary browser.
  • Page 309 Description Displays a dialog box that lets the user choose the target documents for an operation. The dialog box lets the user specify currently open files, files in the project list, or files that are explicitly selected. See also fw.locateDocDialog() fw.closeDocument() Availability Fireworks 3.
  • Page 310 Returns The Document object for the newly created document (see “Document object” on page 14). Description Opens a new document and selects it. Values for size, resolution, and color are the same as the current defaults. To specify values other than the defaults, use fw.createFireworksDocument().
  • Page 311 Arguments A point whose x value specifies the document’s width and whose y value specifies the size document’s height. Both values are in pixels. Specifies the resolution for the scaled document (see “Resolution data type” on page 12). A color string (see “Color string data type”...
  • Page 312 Description Turns off debugging messages for Flash commands. For a description of the Flash debugging capabilities, see on page 312. For more information about fw.enableFlashDebugging() constructing Flash command panels for Fireworks, see “Flash panels” on page 115. The debugging commands work even if you are running a JavaScript file. fw.dismissBatchDialogWhenDone() Availability Fireworks 4.
  • Page 313 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 . The function is particularly useful for MMExecute() fw.enableFlashDebugging() monitoring which commands are executed in a command panel. For information on how to turn off Flash debugging, see “fw.disableFlashDebugging()”...
  • Page 314 Specifies the filename for the exported file. If , Fireworks displays fileURL fileURL null the Export dialog box. Returns A Boolean value: if successful; otherwise. true false Description Exports the specified document to the specified file as Macromedia Director images. Fireworks JavaScript API...
  • Page 315 fw.exportDocumentAs() Availability Fireworks 3. Usage fw.exportDocumentAs(document, fileURL, exportOptions) Arguments A Document object, for example, , that specifies the document fw.documents[2] document to be exported. If , the active document is exported. document null A string, which is expressed as a file://URL, that specifies the filename for the fileURL exported file.
  • Page 316 Arguments A Document object that specifies the document that contains the frames to docObject export (see “Document object” on page 14). To export frames from the current document, pass null The directory where the images will be placed, which is expressed as a file:// directoryURL URL.
  • Page 317 Returns A Boolean value: if successful; otherwise. true false 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.
  • Page 318 fw.exportLayers() Availability Fireworks 4. Usage fw.exportLayers(docObject, directoryURL) Arguments A Document object that specifies the document that contains the layers to docObject export (see “Document object” on page 14). To export layers from the current document, pass null The directory in which the images will be placed, which is expressed as a directoryURL file://URL.
  • Page 319 Returns A Boolean value: if successful; otherwise. true false Description Exports a Fireworks document as a Photoshop document. 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.
  • Page 320 Exports a Fireworks document as a Macromedia Flash document. 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.
  • Page 321 fw.findApp() Availability Fireworks MX. Usage fw.findApp(macAppSignature or winExeRegistryName) Arguments A Macintosh-specific string that identifies the signature of the macAppSignature application to find, such as " ". MKBY A Windows-specific string that identifies the name of an executable winExeRegistryName to find in the Windows registry, such as " ".
  • Page 322 Returns The number of items that are replaced if the search is completed, or if there are items in –1 the document that remain to be searched. Description Finds the next instance of the current search string and selects that section of the document. To begin a search, use fw.setUpFindReplace() See Also...
  • Page 323 Arguments An optional string that is included for compatibility with Dreamweaver. If which-string specified here, it must be "document" Returns The Document object for the active document, or if no document is open. null Description Gets the Document object for the active document (see “Document object”...
  • Page 324 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"...
  • Page 325 fw.getFloaterVisibility() Availability Fireworks 3. Usage fw.getFloaterVisibility(panelName) Arguments Acceptable values are panelName "find" "project log" "object" "info" "url" "effect" "history" "mixer" "fill" "stroke" "swatches" "layers" "frames" , and "behaviors" "optimize" "library" "styles" "optimized colors" "options" "toolbox" Any panels not specified in the list of valid arguments (like those in the Command Panels folder which are “outside”...
  • Page 326 fw.getHTMLFileForScript() Availability Fireworks MX. Usage fw.getHTMLFileForScript() Arguments None. Returns A file URL. Description Returns an HTML file. fw.getNumberOfTables() Availability Fireworks MX. Usage fw.getNumberOfTables(filename) Arguments The name of the file that contains the tables to be counted. filename 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.
  • Page 327 Arguments A string that specifies the Preference value to return. A complete list of these values prefkey is beyond the scope of this documentation, but the format of exactly matches that in prefkey the Fireworks Preferences file. To set a Preference value, use fw.setPref() Returns A string or numeric Preference value.
  • Page 328 Arguments The URL to open in the primary web browser. Returns Nothing. Example The following command starts a browser that opens to the Macromedia website: fw.launchBrowserTo("http://www.macromedia.com"); Description Starts Fireworks’ primary web browser to open a URL. fw.locateDocDialog() Availability Fireworks 4.
  • Page 329 Value File type Adobe Illustrator "ADOBE AI3" Fireworks JSF "Fireworks JavaScript" Bitmap "kMoaCfFormat_BMP" Macromedia FreeHand 7 or 8 "kMoaCfFormat_FreeHand7and8" "kMoaCfFormat_GIF" JPEG "kMoaCfFormat_JPEG" Macintosh PICT "kMoaCfFormat_PICT" Rich text "kMoaCfFormat_RTF" Plain text "kMoaCfFormat_Text" TIFF "kMoaCfFormat_TIFF"...
  • Page 330 , which was added in Fireworks 4, is , the files are opened as bOpenAsNew bOpenAsNew true unsaved and untitled documents. If (the default value), they are opened bOpenAsNew false with their original names. This argument is optional. Boolean. If , which was added in bOpenWithWindowHidden bOpenWithWindowHidden...
  • Page 331 Returns The specified color in format (for syntax details, see “Color string data type” #rrggbbaa on page 11). Description Opens the pop-up color swatches dialog box to let the user select a color. fw.popupColorPickerOverMouse() Availability Fireworks MX. Usage fw.popupColorPickerOverMouse(initialColor, allowTransparent, forceWeb216) Arguments A color string in format, which is the color initially selected in...
  • Page 332 Arguments None. Returns Nothing. Description Quits Fireworks, but prompts the user to save any changed documents before exiting. Identical to fw.quitApplication() fw.quitApplication() Availability Fireworks 3. Usage fw.quitApplication() Arguments None. Returns Nothing. Description Quits Fireworks, but prompts the user to save any changed documents before exiting. fw.readNthTable() Availability Fireworks MX.
  • Page 333 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.readPanelStateFromFile(filepath) Arguments The location of the panel state file as a string in the format file://URL. filepath Returns Nothing.
  • Page 334 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 if the search is not yet complete. –1 Description Performs a replace all operation on the active document using the current...
  • Page 335 Returns Nothing. Description Restores the specified document to its previously saved version. fw.runScript() Availability Fireworks 3. Usage fw.runScript(filename) Arguments The name of the script file to execute. If is not a file URL (that is, if it filename filename does not begin with ), it is assumed to be the name of a file in the Fireworks MX/ "file:///"...
  • Page 336 Returns Nothing. Description Saves all open documents, displaying the Save As dialog box for any documents that were not previously saved. fw.saveDocument() Availability Fireworks 3. Usage fw.saveDocument(document, {fileURL}) Arguments A Document object, for example, , that specifies the document fw.documents[2] document to be saved.
  • Page 337 Arguments A Document object, for example, , that specifies the document fw.documents[2] document to save. If , the active document is saved. document null Returns The file URL for the saved document, or if the dialog box was canceled. null Description Displays the Save As dialog box for the specified document, so that it can be saved as a native Fireworks PNG file with the specified name.
  • Page 338 fw.saveJsCommand() Availability Fireworks 3. Usage fw.saveJsCommand(jscode, filename) Arguments The string of code to be saved as a JSF command file. jscode The name under which the file should be saved. If is not a file URL filename filename (that is, if it does not begin with ), the file is saved in the Fireworks MX/ "file:///"...
  • Page 339 fw.setActiveWindow() Availability Fireworks 3. Usage fw.setActiveWindow(document, {trueFalse}) Arguments A Document object, for example, , that specifies which document fw.documents[2] document should be made active. This optional argument is ignored by Fireworks. It is included only for trueFalse Dreamweaver compatibility. Returns Nothing.
  • Page 340 A lowercase string that specifies the panel into which the panelNameToReceive panel should move. If , the panelNameToMove panelNameToReceive null panel moves into its own panel. Acceptable values are panelNameToMove "find" "project log" "object" "info" "url" "effect" "history" "mixer" "fill" "stroke"...
  • Page 341 Arguments Acceptable values are panelName "find" "project log" "object" "info" "url" "effect" "history" "mixer" "fill" "stroke" "swatches" "layers" "frames" "behaviors" "optimize" "library" "styles" "optimized colors" "options" "toolbox" Any panels not specified in the list of valid arguments (like those in the Command Panels folder which are “outside”...
  • Page 342 , the specified panel is visible. If , the panel bVisible bVisible true bVisible false is hidden. Returns Nothing. Description Shows or hides the specified panel. fw.setHideAllFloaters() Availability Fireworks 3. Usage fw.setHideAllFloaters(bHide) Arguments , the panels are hidden. If , the panels are visible. bHide bHide true...
  • Page 343 Returns Nothing. Description Sets the value that is associated with the specified Preference key. See also fw.getPref() fw.setUpFindReplace() Availability Fireworks 3. Usage fw.setUpFindReplace(findSpec) Arguments A Find object (see “Find object” on page 23). findSpec Returns Nothing. Description Sets up a search. fw.toggleFloater() Availability Fireworks 3.
  • Page 344 Arguments Acceptable values are panelName "find" "project log" "object" "info" "url" "effect" "history" "mixer" "fill" "stroke" "swatches" "layers" "frames" "behaviors" "optimize" "library" "styles" "optimized colors" "options" "toolbox" Any panels not specified in the list of valid arguments (like those in the Command Panels folder which are “outside”...
  • Page 345 fw.updateHTML() Availability Fireworks 4. Usage fw.updateHTML(doc, htmlUrl, bRecoverFromError) Arguments A Document object that specifies the document to be used for updating the HTML (see “Document object” on page 14). If , the active document is used. null The filename of the HTML file to update, which is expressed as a file://URL. To htmlUrl force Fireworks to display the Update HTML dialog box, pass .
  • Page 346 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 The prompt message that appears in the dialog box. promptString Returns A Boolean value:...
  • Page 347: Property Inspector Functions

    Property inspector functions These functions control the Property inspector window, which shows details about the current document or selected object. fw.showPIWindow() Availability Fireworks MX. Usage fw.showPIWindow() Arguments None. Returns Nothing. Description Opens the Property inspector. fw.hidePIWindow() Availability Fireworks MX. Usage fw.hidPIWindow() Arguments None.
  • Page 348 fw.isPIExpanded() Availability Fireworks MX. Usage fw.isPIExpanded() Arguments None. Returns A Boolean value: if expanded; otherwise. true false Description Determines whether the Property inspector window is currently expanded or minimized fw.isPIVisible() Availability Fireworks MX. Usage fw.isVisible() Arguments None. Returns A Boolean value: if visible;...
  • Page 349 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 A point in screen coordinates. Returns Nothing. Property inspector functions...
  • Page 350: History Panel Functions

    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 y: float} (see “Point data type” on page 12 {x: float syntax details), which contains the location of the Property inspector.
  • Page 351 Description Clears the undo and redo stack. fw.historyPalette.copySteps() Availability Fireworks 3. Usage fw.historyPalette.copySteps(array of indexes) Arguments A zero-based array that specifies which steps from the History panel array of indexes should be copied. If it is , the currently selected steps are used. null Returns Nothing.
  • Page 352 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(array of indexes) Arguments A zero-based array that specifies which steps from the History panel array of indexes should be returned as JavaScript.
  • Page 353 fw.historyPalette.getUndoState() Availability Fireworks 3. Usage fw.historyPalette.getUndoState() Arguments None. 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 . This string is designed to be used internally by fw.historyPalette.setUndoState() Fireworks only and might change format in the future.
  • Page 354 Description Gets the JavaScript equivalent of the specified steps and executes them. See also fw.historyPalette.getStepsAsJavaScript() fw.historyPalette.saveAsCommand() Availability Fireworks 3. Usage fw.historyPalette.saveAsCommand(array of indexes, {filename}) Arguments Indicates which steps from the History panel should be saved. For array of indexes example, to save the first, third, and sixth steps in the History panel, pass [ ].
  • Page 355: Static Document Functions

    Returns Nothing. Description Sets the portion of the History panel that is selected. fw.historyPalette.setUndoState() Availability Fireworks 3. Usage fw.historyPalette.setUndoState(undoStateString) Arguments The string returned by undoStateString fw.historyPalette.getUndoState() Returns Nothing. Description Performs the correct number of undo or redo operations to arrive at the selected state. See Also fw.historyPalette.getUndoState() Static Document Functions...
  • Page 356 Arguments A string that specifies the name of the set of export settings to find. name 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.
  • Page 357: Using The Common Api

    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 .The following methods are currently supported in Fireworks and app.methodName()
  • Page 358 Fireworks JavaScript API...
  • Page 359: Index

    Index applyEffects() 154 applyFontMarkup() 155 ActionScript 116 applyStyle() 155 cross-product extensions 99 arguments, optional 10 addBehavior() 132, 133 arrange() 156 addElementMask() 138 attachTextToPath() 156 addFrames() 138 Auto Shapes 123 addGuide() 139 defining 123 addNewHotspot() 140 helper functions 125 addNewImage() 140, 141, 142 icons 124 addNewImageViaCopy() 141 switch statement 129...
  • Page 360 clearSteps() 350 deleteAllInDocument() 172 clipCopy() 159, 160 deleteFrames() 173 clipCopyAsPaths() 160 deleteLayer() 173 clipCopyFormats() 160 deletePointOnPath() 174 clipCut() 161 deleteSelection() 175 clipPaste() 161 deleteSymbol() 176 clipPasteAsMask() 162 deprecated functions or arguments clipPasteAttributes() 163 dom.clipPasteInside() 164 clipPasteFromChannelToChannel() 164 dom.getPixelMask 193 clipPasteInside() 164 dom.group() 197 cloneSelection() 165 dom.setAnimInstanceStartFrame() 248...
  • Page 361 dom.applyCharacterMarkup() 153 dom.enableTextAntiAliasing() 185 dom.applyCurrentFill() 153 dom.enterElementMaskEditMode() 185 dom.applyEffects() 154 dom.enterPaintMode() 186 dom.applyFontMarkup() 155 dom.exitElementMaskEditMode() 186 dom.applyStyle() 155 dom.exitPaintMode() 187 dom.arrange() 156 dom.exportOptions.loadColorPalette() 187 dom.attachTextToPath() 156 dom.exportOptions.saveColorPalette() 188 dom.changeGuide() 157 dom.exportTo() 188 dom.changeSliceGuide() 158 dom.fillSelectedPixels() 189 dom.clearJPEGMask() 159 dom.filterSelection() 190 dom.clipCopy() 159 dom.filterSelectionByName() 190, 191 dom.clipCopyAsPaths() 160...
  • Page 362 dom.moveSelectionBy() 214 dom.selectParents() 241 dom.moveSelectionMaskBy() 214 dom.selectSimilar() 242 dom.moveSelectionTo() 215 dom.selectSimilarFromPoint() 242 dom.moveSelectionToFrame() 216 dom.sendEmail() 243 dom.moveSelectionToLayer() 216 dom.setAllLayersDisclosure() 244 dom.moveSelectionToNewLayer() 217 dom.setAnimInstanceLoopCount() 244 dom.pathCrop() 217 dom.setAnimInstanceNumFrames() 245 dom.pathExpand() 218 dom.setAnimInstanceOffsetDist() 245 dom.pathInset() 218 dom.setAnimInstanceRotationAmount() 246 dom.pathIntersect() 219 dom.setAnimInstanceScaleAmount() 246 dom.pathPunch() 219 dom.setAnimInstanceStartEndOpacity() 247 dom.pathSimplify() 220...
  • Page 363 dom.setGridOrigin() 269 dom.setTextOnPathMode() 296 dom.setGridSize() 269 dom.setTextOnPathOffset() 296 dom.setGroupType() 270 dom.setTextOrientation() 297 dom.setGuideColor() 271 dom.setTextParaIndent() 297 dom.setHotspotAltTag() 271 dom.setTextParaSpacingAfter() 298 dom.setHotspotColor() 272 dom.setTextParaSpacingBefore() 298 dom.setHotspotRectangle() 272 dom.setTextRectangle() 300 dom.setHotspotShape() 273 dom.setTextRectangleAuto() 300 dom.setHotspotTarget() 273 dom.setTextRectangleAutoFromPoint() 301 dom.setHotspotText() 274 dom.setTextRuns() 299 dom.setLayerDisclosure() 275 dom.setTransformMode() 299 dom.setLayerLocked() 275...
  • Page 364 EffectList object 48 exportIllustrator() 317 effectList property 94 exporting HTML and sliced images 80 effects, finding and replacing 24 exportLayers() 318 EFileIsReadOnly 19 ExportOptions object 58, ??–60 EFileNotFound 19 exportOptions.loadColorPalette() 187 EGenericErrorOccurred 19 exportOptions.saveColorPalette() 188 EGroupDepth 19 ExportPaletteInfo object 61 EIllegalThreadAccess 19 exportPSD() 318 EInternalError 19...
  • Page 365 Flash wrapper extension 118 fw.historyPalette.getSelection() 351 flattenDocument() 192 fw.historyPalette.getStepCount() 352 flattenSelection() 192 fw.historyPalette.getStepsAsJavaScript() 352 fonts, finding and replacing 24 fw.historyPalette.getUndoState() 353 Frame object 65 fw.historyPalette.replaySteps() 353 frameIndex argument 131 fw.historyPalette.saveAsCommand() 354 FrameNLayerIntersection object 66 fw.historyPalette.setSelection() 354 func 102 fw.historyPalette.setUndoState() 355 fw and fireworks class names 305 fw.isPIExpanded() 348 fw.browseDocument() 305...
  • Page 366 historyPalette.setUndoState() 355 Hotspot object 53 Gaussian Blur property (Effect object) 45 HTML export objects 80 get 102 Hue (Effect object) 45 GetDefaultMoveParms() 76 Hue/Saturation (Effect object) 45 getDocumentDOM() 322 getDocumentPath() 323 getFloaterGroupings() 323 getFloaterPosition() 324 Image object 52 getFloaterVisibility() 325 ImageMap object 88, 89 getFontMarkup() 193 ImagemapList object 89...
  • Page 367 launchApp() 327 new features 6 launchBrowserTo() 328 null values 131 Layer object 67 layerIndex argument 131 Levels (Effect object) 46 linkElementMask() 205 object loadColorPalette() 187 Behavior 33 BehaviorInfo 80 BehaviorsList 84 Brush 33 makeActive() 207 Contour 36 makeFind() 206 ContourNode 37 makeGoodNativeFilePath() 356 ContourNodeDynamicInfo 39 mask 11...
  • Page 368 Slices 91 Style 76 readNthTable() 332 Text 55 readPanelStateFromFile() 333 TextAttrs 78 rebuildColorTable() 221 TextRuns 79 rectangle 12 Texture 56 rectangle primitive 145 objects redo() 222 accessing within documents 32 redraw() 222 classification 92 reflectSelection() 223 core objects 13 RegisterMoveParms 70 selected 92 release 103 openDocument() 329...
  • Page 369 RPCMethods.DestroyAutoReleasePool() 111 setButtonAutoSlice() 252 RPCMethods.ReleaseObject() 112 setButtonIncludeDownState() 252 RPCMethods.RemoveFromAutoReleasePool() 112 setButtonIncludeOverWhileDownState 253 runScript() 335 setButtonIncludeOverWhileDownState() 253 setButtonOptions 254 setButtonOptions() 254 setButtonShowDownOnLoad() 253 setDefaultBrushAndFillColors() 254 Saturation properties (Effect object) 45 setDefaultFillVector() 255 save() 234 setDocumentCanvasColor() 255 saveAll() 335 setDocumentCanvasSize() 256 saveAsCommand() 354 setDocumentCanvasSizeToDocumentExtents() 256 saveColorPalette() 188 setDocumentCanvasSizeToSelection() 257...
  • Page 370 setLayerSharing() 277 setTransformMode() 299 setLayerVisible() 277 setUndoState() 355 setMatteColor() 278 setUpFindReplace() 343 setOnionSkinning() 279 Sharpen (Effect object) 47 setOpacity() 280 Sharpen More (Effect object) 48 setPIPosition() 349 showAllHidden() 301 setPixelMask() 279 showPIWindow() 347 setPref() 342 shrinkPIWindow() 349 setQuadrangle() 281 SingleTextRun object 74 setRectRoundness() 281 sliced images 80 setRectSides() 282...
  • Page 371 values 10 Working with selected elements 132 write() 13 WRITE_HTML() 13 writePanelStateToFile() 345 XML 100 yesNoDialog() 346 zero-based indexes 131 Index...
  • Page 372 Index...

This manual is also suitable for:

Fireworks 8

Table of Contents