Extending Fireworks
Trademarks 1 Step RoboPDF, ActiveEdit, ActiveTest, Authorware, Blue Sky Software, Blue Sky, Breeze, Breezo, Captivate, Central, ColdFusion, Contribute, Database Explorer, Director, Dreamweaver, Fireworks, Flash, FlashCast, FlashHelp, Flash Lite, FlashPaper, Flash Video Encoder, Flex, Flex Builder, Fontographer, FreeHand, Generator, HomeSite, JRun, MacRecorder, Macromedia, MXML, RoboEngine, RoboHelp, RoboInfo, RoboPDF, Roundtrip, Roundtrip HTML, Shockwave, SoundEdit, Studio MX, UltraDev, and WebHelp are eith
Contents Chapter 1: Extending Fireworks Overview . . . . . . . . . . . . . . . . . . . . 5 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Installing an extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 What’s new in Extending Fireworks 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Conventions used in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
CHAPTER 1 1 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.
Installing an extension As you start learning the process of writing extensions, you might want to explore the extensions and resources already available through the Macromedia Exchange website (www.macromedia.com/exchange). By installing an existing extension, you will become familiar with some of the tools that you need to work with your own extensions. To install an extension: 1. Download and install the Extension Manager, which is available on the Macromedia Downloads website (www.macromedia.
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.
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.
2 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 Model, which contains the following major components: ■ Six global methods that are available from any part of the application and need not be declared as methods of a particular object.
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. N OT E ■ You can use methods that operate on a document’s DOM only on open documents.
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 fw.getDocumentDOM() function references the current document (for more information, see “Accessing a Fireworks document” on page 10). fw.getDocumentDOM().setDocumentResolution({pixelsPerUnit:72, units:"inch"}) ; fw.documents[0].resolution =72; fw.documents[0].
Matrix data type The format for a matrix is {matrix: [float, float, float, float, float, float, float, float, float]}. This guide assumes that you know how to use these nine values to construct a three-by-three transformation matrix; discussion of the construction of transformation matrices is beyond the scope of this manual. Point data type The format for a point is {x: float, y: float}. For instance, dom.addNewLine(startPoint, endPoint) could look like the following example: fw.getDocumentDOM().
Method Data type Notes prompt(caption, text) string, string Prompts the user (with the string that is specified by text) to enter a string in a modal dialog box; the dialog box is titled with the string that is specified by caption. Returns the string entered if OK is clicked, null if Cancel is clicked. write(arg1, arg2, ..., argN) string Same as WRITE_HTML; WRITE_HTML was created to let you differentiate HTML output calls from other JavaScript calls in your code.
Document object The following table lists the properties of the Document object, along with their data types, acceptable values and notes. Read-only properties are marked with a bullet (•). You can also use many API calls to work with documents. For more information, see “Document functions” on page 132. Property Data type Notes backgroundColor string A color string that specifies the document canvas color (for more information, see “Color string data type” on page 11).
Property Data type Notes filePathForRevert string The path to the file from which this document was opened, which is expressed as file://URL, or null if created from scratch. filePathForSave string The location to which this document was saved, which is expressed as file://URL, or null if never saved. fills • array Array of Fill objects that are available for use in the document (for more information, see “Fill object” on page 64).
Property Data type Notes height integer Total height of the document, in pixels. To find the bottom edge of the document, use document. top + document.height. isDirty Boolean Set to true if the document was modified since the last ti me it was saved. isPaintMode • Boolean Set to true if the document is currently in paint-mode editing, false otherwise. isSymbolDocument • Boolean Set to true if the document is a Symbol or Button document, false if it is an ordinary document.
Property Data type Notes mapType string Acceptable values are "client", "server", and "both". Corresponds to the image-map type selected in File > HTML Properties > ImageMap. matteColor string A color string that corresponds to the matte color specified in the Optimize panel (for more information, see “Color string data type” on page 11). This string is used by the useMatteColor property. onionSkinAfter integer Number of frames after the current frame to show through onion skinning.
Property Data type Notes textures array Array of Texture objects that are available for use in the document (for more information, see “Texture object” on page 56). top integer Coordinate of the top edge of the document, in pixels. To find the bottom edge of the document, use document.top + document.height. useMatteColor Boolean If set to true, the matteColor property is used when exporting documents with transparent backgrounds.
The following list contains the properties of the Errors object alphabetically: EAppAlreadyRunning, EAppNotSerialized, EArrayIndexOutOfBounds, EBadFileContents, EBadJsVersion, EBadNesting, EBadParam, EBadParamType, EBadSelection, EBufferTooSmall, ECharConversionFailed, EDatabaseError, EDeletingLastMasterChild, EDiskFull, EDuplicateFileName, EFileIsReadOnly, EFileNotFound, EGenericErrorOccurred, EGroupDepth, EIllegalThreadAccess, EInternalError, ELowOnMem, ENoActiveDocument, ENoActiveSelection, ENoFilesSelec
Method Data type Notes deleteFile(docOrDir) string Deletes the specified file or directory. Returns true if successful; false if the file or directory does not exist or cannot be deleted. Compare with deleteFileIfExisting(). deleteFileIfExisting (docOrDir) string enumFiles(docOrDir) string Deletes the specified file or directory. Returns true if successful; false if the file or directory cannot be deleted. Unlike deleteFile(), this method returns true if the file or directory does not exist.
Method Data type Notes getLastErrorString() none If the last call to a method in a Files object resulted in an error, returns a string that describes the error. If the last call succeeded, returns null. getTempFilePath ({dirname}) string The argument, if used, must be expressed as file://URL. Returns a file URL in the Temporary Files directory or in the specified directory.
Method Data type Notes rename(docname, newPlainFilename) string, string The docname argument is a file path or a file URL to the file that you want to rename. The newPlainFilename argument is the new name to assign to the file. The rename method returns a URL path of the newly renamed file if successful; otherwise Fireworks returns null. setFilename(docname, newPlainFilename) string, string The first argument must be expressed as file://URL.
File Reference object The File Reference object is used to refer to a specific open file. The following table lists the methods of the File Reference object, along with their data types and, where appropriate, acceptable values and notes. Method Data Type Notes close() none Closes the current File Reference object. You are not required to use this method (the file is closed when the Files object is destroyed), but it is useful for controlling access to a file.
Property Data type Notes replace string Text to use as replacement text. wholeWord Boolean If set to true, only whole words matching the search text are found. The default is false. Finding and replacing fonts and styles Property Data type Notes whatToFind string In the format: "font" find string Name of font to find. replace string Name of font to use as replacement.
Property Data type Notes fills Boolean If set to true, fills that match the specified colors are replaced. strokes Boolean If set to true, strokes that match the specified colors are replaced. effects Boolean If set to true, effects that match the specified colors are replaced. Finding and replacing URLs Property Data types Notes whatToFind string In the format: "url" find string URL to find, which is expressed as file:// URL.
System object The following table lists the properties of the System object, along with their data types and, where appropriate, acceptable values and notes. All System properties are read-only. Property (read-only) Data type Notes osName string Returns the name of the operating system under which Fireworks is running. controlFaceColor string Returns the system color used for the control and panel faces (Windows-only property).
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 (•). NO TE For information on how to format nonstandard data types, such as rectangle or point, see “Formatting nonstandard data types” on page 11. Refer to the Fireworks object by using fw.propertyName or fireworks.propertyName. Note that fireworks must be lowercase.
Property Data type Notes appMacCreator • string In the format: "MKBY" appMacJsfFileType • string In the format: "TEXT" appName • string The name of the application ("Fireworks 8"). This attribute is part of the common API, so it also appears as app.appName (as implemented in Macromedia Dreamweaver). appPatternsDir • string The path to the Patterns directory, which is expressed as file://URL. appPrefsDir string The path to the Preferences directory, which is expressed as a file://URL.
Property Data type Notes appXtrasDir • string The path to the Xtras directory, which is expressed as file://URL. batchStatusString string The string that currently appears in the Batch Progress dialog box. Set this property to change the string being displayed. Use with progressCountCurrent and progressCountTotal. currentScriptDir string The path to the directory of the currently running script, which is expressed as a file:/ /URL (or could be null).
Property Data type Notes ellipseBCPConst • float A fixed value of 0.55229187012 used to 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 100*fw.ellipseBCPConst pixels away from the point itself. errorReportingOK Boolean If set to true, Fireworks will allow posting an error while a script is running.
Property Data type Notes progressCountCurrent integer The first number (x) that appears in the Batch Progress dialog box, in the “File x of y” field. Set this property to change the number. progressCountTotal integer The second number (y) that appears in the Batch Progress dialog box, in the “File x of y” field. Set this property to change the number. screenRect • rectangle The size of the main screen on this computer, in pixels. Useful for positioning windows or panels.
Property Data type Notes userJsCommandsDir string The path to the user-level Commands directory, which is expressed as a file:// URL. In Fireworks, this folder is stored on a peruser basis on multiuser systems. Even on single-user systems, this folder is not inside the Fireworks installation directory.
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 call string The JavaScript call for the behavior. For legal values, see “Using the dom.addBehavior() function” on page 133. event string Acceptable values are "onMouseOver", "onClick", "onMouseOut", "onLoad", and "**ANY**" (the **ANY** argument is used as a wildcard value in some situations).
Property Data type Notes feedback string Acceptable values are "none", "brush", and "background". flowRate float 0 to 100 maxCount integer 0 to 64 minSize float 0 to 100 name string The name of the brush, which is visible in the Stroke panel.
Property Data type sense_random_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_saturatio
Property Data type Notes textureBlend float 0 to 100 textureEdge float 0 to 100 tipColoringMode string Acceptable values are "random", "uniform", "complementary", "hue", and "shadow". tipCount integer 1 to 32 tipSpacing float 0 to 100 tipSpacingMode string Acceptable values are "random", "diagonal", and "circular". string type Acceptable values are "natural" and "simple".
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 dynamicInfo array Array of ContourNodeDynamicInfo objects on this ContourNode object (for more information, see “ContourNodeDynamicInfo object” on page 39). isCurvePoint Boolean If set to true, this point’s control points are constrained to be linear with the main point, which forces a smooth curve.
The following table lists the methods of the ContourNode object, along with their parameters. Method Parameter Definition RegisterMove() object The RegisterMoveParms object containing the move parameters. Use smartShape.GetDefaultMoveParms() to obtain this object, then adjust properties as needed. For a list of properties, see “RegisterMoveParms object” on page 70. RegisterLinearMove() point A point, which in combination with the node point, defines the line to move along.
ContourNodeDynamicInfo object The following table lists the properties of the ContourNodeDynamicInfo object, along with their data types and, where appropriate, acceptable values and notes. Property Data type Notes duration float 0.0 to 65,535.0 milliseconds pressure float 0.0 to 1.0 velocity float 0.0 to 255.
The following table lists the methods of the ControlPoint object, along with their parameters. Method Parameter Definition RegisterMove() object The RegisterMoveParms object containing the move parameters. Use smartShape.GetDefaultMoveParms() to obtain this object, then adjust properties as needed. For a list of properties, see “RegisterMoveParms object” on page 70. RegisterLinearMove() point A point, which in combination with the node point, defines the line to move along.
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. N OT E In addition to the listed properties, each Effect object has two optional string properties: category and name.
Property Data type Notes EffectMoaID string "{7fe61102-6ce2-11d1-8c76000502701850}" EmbossFaceColor string A color string that specifies the color that is blended onto the face of the object when embossing (for more information, see “Color string data type” on page 11). GlowStartDistance integer Specifies how far away from the object the glow starts, in pixels. Specify a negative value to create “ring” glows and a positive value to create “halo” glows.
Property Data type Notes SlopeMultiplier float A multiplier that is used to calculate the 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.
Convert to Alpha object Property Data type Notes EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true. EffectMoaID string "{2932d5a2-ca48-11d1-8561000502701850}" Property Data type Notes EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true.
Find Edges object Property Data type Notes EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true. EffectMoaID string "{fc7093f1-f95c-11d0-8be200a024cdc039}" Property Data type Notes EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true. EffectMoaID string "{d04ef8c0-71b3-11d1-8c8200a024cdc039}" gaussian_blur_radius float 0.
Inner Shadow object Property Data type Notes EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true. EffectMoaID string "{5600f702-774c-11d3-baad0000861f4d01}" ShadowAngle integer The angle of the shadow, in degrees. ShadowBlur integer The feathering amount of the shadow edges, in pixels. ShadowColor string A color string that specifies the color of the shadow (for more information, see “Color string data type” on page 11).
Property Data type Notes source_low_rgb* integer These source* values are all input levels to the filter, with values of 0 to 255. integer These dest* values are all output levels to the filter, with values of 0 to 255. float These gamma* values are all gamma levels to the filter, with values of 0.1 to 10.0.< Property Data type Notes EffectMoaID string "{c20952b1-fc76-11d0-8be700a024cdc039}" EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden.
Sharpen More object Property Data type Notes EffectMoaID string "{1f2f2591-9db7-11d1-8cad00a024cdc039}" EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true. Unsharp Mask object Property Data type Notes EffectMoaID string "{f1cfce44-718e-11d1-8c8200a024cdc039}" EffectIsVisible Boolean If set to false, the effect is included but temporarily hidden. The default value is true.
Element object Element is an abstract or base class; nothing of class Element ever exists. However, it is useful for simplifying the other class descriptions. Read-only properties are marked with a bullet (•). Property Data type blendMode string Notes Acceptable values are "normal", "multiply", "screen", "darken", "lighten", "difference", "hue", "saturation", "color", "luminosity", "invert", "tint", and "erase". customData struct Assign any objects (array, integer, string, and so on).
Property Data type Notes visible Boolean If set to false, the element is hidden. The default value is true. width • float Read-only in the base class; other 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. Method Parameter Definition generateSmartShapeCode root The root parameter is a string value that is prefixed to each line of output.
Property Data type Notes smartShapeCode string The body of code in the JavaScript file that defines the Auto Shape object. transformMode string Can be one of the following: If the Auto Shape is transformed in any way (scale, skew, rotate) the transformation matrix is modified. "DontTransformUniformScale" If the Auto Shape is scaled in uniformly, the actual points are moved; otherwise, the transformation matrix is modified.
Method Parameter Definition unRegisterAllEvents() none Call this to stop receiving notification of all previously registered events. UnRegisterForEvent() string Call this to stop receiving notification of a single previously registered event. Image object Image is a subclass of the base class Element (for more information, see “Element object” on page 49). It contains no properties or methods other than those in Element.
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). Property Data type Notes altText string Text that is written into the HTML Alt tag when exporting. behaviors array Array of Behavior objects for the Hotspot (for more information, see “Behavior object” on page 33).
Property Data type Notes htmlText string If sliceKind is set to "empty", this text is exported instead of the image. The default is an empty string. sliceID • string An arbitrary string that uniquely identifies this slice. sliceKind string If set to "image", generates an image; if set to "empty", generates the text specified by htmlText. tdTagText string This string contains all the attributes of a table cell except the colspan and rowspan values.
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 antiAliased Boolean If set to true (the default), anti-aliases the text. antiAliasMode string Acceptable values are "smooth", "crisp", and "strong". This value is ignored if the antiAliased property is set to false.
Property Data type Notes rawWidth float Width of the area occupied by the pixels (not the area of the bounding box). rawHeight float Height of the area occupied by the pixels (not the area of the bounding box). Texture object The Texture object has the following read-only property. Property (read-only) Data type Notes name string The name that appears in the Brush or Fill panels.
Property Data type mode string Notes Acceptable values are "mask to image" and "mask to path". owner object The element (image, path, text, and so on) that owns the mask. showAttrs Boolean If set to true, and mode is "mask to path", the mask element’s fill and stroke (if any) are drawn. If set to false, the mask element’s fill and stroke are ignored.
ExportOptions object NO TE 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: ■ If useScale is set to true (the default), percentScale is used to uniformly scale the object on export, and applyScale is ignored.
Property Data type Notes colorMode string Acceptable values are "indexed" (the default), "24 bit", and "32 bit". crop Boolean The default value is false. cropBottom integer The default value is 0. cropLeft integer The default value is 0. cropRight integer The default value is 0. cropTop integer The default value is 0. ditherMode string Acceptable values are "none" (the default), "diffusion", and "2 by 2". ditherPercent integer exportFormat string 0 to 100; default value is 100.
Property Data type Notes paletteInfo array Array of ExportPaletteInfo objects, or null if all entries in the array are default values (for more information, see “ExportPaletteInfo object” on page 61); default value is null. paletteMode string Acceptable values are "adaptive" (the default), "custom", "grid", "monochrome", "Macintosh", "Windows", "exact", and "Web 216". paletteTransparencyType string Acceptable values are "none" (the default), "index", "index alpha", and "rgba".
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 colorLocked Boolean Set to true if the color is locked in the panel. The default value is false. colorModified Boolean Set to true if the color was edited. The default value is false. colorSelected Boolean Set to true if the color is selected in the panel (selection is a temporary attribute).
Property Data type exportFileStyle string Notes Acceptable values are: “HTML and Images” “Images Only” “Dreamweaver LBI” "Director HTML" "CSS Layers" "Layers to Files" "Frames to Files" "Lotus Domino" "Macromedia Flash SWF" "Illustrator" "Photoshop" fileExtension string Defines the extension to append to the filename. generateDemoHtml Boolean If set to true, generates multiple HTML pages for button export. htmlDestination string Acceptable values are "same", "custom", and "clipboard".
Property Data type Notes sliceAutoNaming1 through string Used to generate a name by concatenating six strings. If you need fewer than six strings, fill in the remaining strings with "none". Acceptable values are: "none" — generates nothing. "row_col" — generates a unique row and column index; 0_0 is first, 0_1 is second, and so on. "ALPHA" — generates a unique uppercase letter: A is first, B is second, and so on. "alpha" — generates a unique lowercase letter: a is first, b is second, and so on.
Property Data type Notes sliceFrameNaming1 and string Used to generate a name by concatenating two strings; the resulting string is concatenated to the name specified by sliceAutoNaming. If you need fewer than two strings, fill in the remaining string with "none". Acceptable values are: "none" — generates nothing. "frameNumber" — generates frame number preceded by f, for example, f2. "number" — generates frame number, for example, 2.
Property Data type Notes edgeType string Acceptable values are "hard" and "antialiased". feather integer 0 to 1000, which represents the feathering value in pixels (0 means no feathering). gradient object Gradient object (see “Gradient object” on page 66). name string The name that appears in the Fill panel. pattern object Pattern object (see “Pattern object” on page 68).
Property Data type Notes layers • array Array of FrameNLayerIntersection objects in the document (see FrameNLayerIntersection object on page 66). visible Boolean If set to false, this frame is hidden. Default 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. Read-only properties are marked with a bullet (•).
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 color string A color string that specifies the color at this position in the gradient (see “Color string data type” on page 11). isOpacityNode Boolean If set to true, this node is part of the gradient’s opacity ramp. position float 0.0 to 1.
Layer object The following table lists the properties of the Layer object, along with their data types and, where appropriate, acceptable values and notes. Read-only properties are marked with a bullet (•). Property Data type Notes disclosure Boolean If set to true, the Layers list displays all the objects in the layer. If set to false, only the name of the layer appears. frames • array An array of FrameNLayerIntersection objects (see “FrameNLayerIntersection object” on page 66).
Property Data type Notes fillHandle1 point fillHandle2 point The three fillHandle properties are used by Gradient and Pattern fills to set the angle and size of the gradient/pattern. fillHandle3 point fillOnTop Boolean If set to true, the fill is drawn on top of the brush; if set to false (the default), the fill is drawn beneath the brush. fillTexture object Texture object (see “Texture object” on page 56).
Property Data type Notes transform matrix A matrix that indicates all the transformations that were applied to the primitive (see “Matrix data type” on page 12). pathAttributes object A PathAttrs object that indicates the path attributes of the primitive (see “PathAttrs object” on page 68). RegisterMoveParms object The following table lists the properties of the RegisterMoveParms object, along with their data types and, where appropriate, acceptable values and notes.
Property Data type Notes constrainY The value to constrain the y coordinate. Note: the method constrainYKey must be used with this method. constrainYKey Pass in the key that you want to use to constrain the y-coordinate value. A value of "none" means that y will not be constrained. A value of "shiftKey" means that when the user holds downs the Shift key while dragging the mouse, the value of y will be constrained. The value can be one of the following: "none", "shiftKey", "ctrlCmdKey", "altOptKey".
Property Data type Notes deltaRtoR float Determines the mouse radius change relative to the point radius change. For example, a value of 1.0 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. deltaShortestSideToX float The ratio of shortest mouse movement to the movement of referenced point’s x coordinate.
Property Data type Notes deltaYtoY float The ratio of mouse movement to the movement of the referenced point’s y coordinate. For example, 1.0 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. disableRotateKey string Pass in the key that you want to use to disable rotating around the center. The value can be one of the following: "none", "shiftKey", "ctrlCmdKey", "altOptKey".
Property Data type Notes minMaxRelative Boolean Determines whether the min and max values are relative or absolute. For example, if max.x=100 and minMaxRelative is true, then x can move up 100 points to the right. If minMaxRelative is set to false then the maximum x can be set to is 100. minX float The minimum value the x coordinate can move. minY float The minimum value the y coordinate can move. minRadius float The minimum radius value.
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 altOptKeyDown • Boolean Indicates whether the Alt/Option key is pressed (true if pressed, otherwise false).
Property Data type Notes livePreview Boolean Sets live preview. A value of true enables live preview, and disables wireframe 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 “Fireworks messages” on page 126. mouseDownPos • point Location of the mouse during a mouse click.
Property (read-only) Data type Notes tdTagText string A string that contains all the attributes of a table cell except colspan and rowspan. Should be in a format similar to the following: "bgcolor="ff0000" valign="top"“ textBold Boolean textFont string Whether to make the specified text bold; used only if use_textStyles is set to true. The font to apply to text; used only if use_textFont is set to true.
Property (read-only) Data type Notes use_textFont Boolean If set to true, applies the textFont property of the pathAttrs object when applying the style. If set to false, ignores the textFont property. The default value is false. use_textSize Boolean If set to true, applies the textSize property of the pathAttrs object when applying the style. If set to false, ignores the textSize property. The default value is false.
Property Data type Notes kerning float Also known as pair kerning, kerning specifies the percentage of an em square by which to separate two characters, in addition to the amount the font specifies. Applies to only one pair or characters. To specify kerning for a range of text, use the rangeKerning property.
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 initialAttrs object TextAttrs object (see “TextAttrs object” on page 78). textRuns array Array of SingleTextRun objects on this TextRuns object (see “SingleTextRun object” on page 74). HTML export objects Fireworks provides several object types that support the output of HTML and sliced images from Fireworks.
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. All BehaviorInfo object properties are read-only.
Property (read-only) Data type Notes downHighlight Boolean If action is set to 6 (Button Highlight), specifies if there is an image highlight for the Down button state. event integer Specifies the type of event: 0 is Mouse Over, 1 is On Click, 2 is Mouse Out, and 3 is On Load.
Property (read-only) Data type Notes hiliteColor string If action is set to 9 (Popup Menu), specifies the highlight color at the upper-left of the menu cells. menuFontFamily string If action is set to 9 (Popup Menu), specifies the name of the font family to use for the menu. menuHeight integer If action is set to 9 (Popup Menu), specifies the height in points of the menu cell. menuImagePath string If action is set to 9 (Popup Menu), specifies the path to the first image.
Property (read-only) Data type Notes targetFrameNum zero-based index If action is set to 2 (Swap Image), specifies the frame number to be swapped if hasTargetFrame is set to true. targetRowNum zero-based index If action is set to 2 (Swap Image), specifies the row in the slices table that is swapped. targetTable object If action is set to 2 (Swap Image), specifies the table of slices in the target swap frame.
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, behaviors is an object of type BehaviorsList, and curBehavior is an object of type BehaviorInfo. var curBehavior = slices[i][j].
Property (read-only) Data type Notes docID integer A number that is assigned to a document to help identify HTML generated from it. The docID does not change when you change the name of a file. However, if you use File > Save As, you can get multiple files with the same docID. docSaveFolder string Contains the path of the directory into which the document was last saved. If the document has not yet been saved, this is an empty string.
Property (read-only) Data type Notes hasBackgroundLink Boolean Set to true if the Fireworks document has a background URL. height integer Height of the image that is being exported, in pixels. In the Slices.htt file, it is the total height of the output images. htmlEncoding string Determines the encoding standard for the HTML file that Fireworks generates during export. Use "iso-8859-1" for ASCII or "utf-8" for Unicode.
Property (read-only) Data type Notes style string The HTML style that is used to export the data, such as "Dreamweaver", "Generic", or "FrontPage". tableAlignment string A string that contains the alignment of the table. If the table is left-aligned, the string is simply a space (this is used for writing the HTML table). If the table is center-aligned, the string is "align="center"". If the table is right-aligned, the string is "align="right"".
Property (read-only) or Method Data type Notes numCoords integer Number of coordinates in the area. A circle always has 1 (the center), a rectangle has 2 (top left and bottom right), and a polygon has 1 or more. radius integer Radius of the area, if shape is "circle". shape string Acceptable values are "circle", "poly", and "rect". targetText string Target text for this image, if any. xCoord(index) zero-based index Returns the x coordinate for the specified point, in pixels.
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 method Data type Notes altText string The alternate text description for this slice. behaviors object BehaviorsList object that contains the behaviors for this slice (see “BehaviorsList object” on page 84).
Property (read-only) or method Data type Notes htmlText string Text for a text-only slice. imagemap object ImagemapList object containing the image map information for this slice (see “ImagemapList object” on page 89). imageSuffix string Extension for the image in this cell, including a period (.); for example, ".gif". isUndefined Boolean Set to true if the slice does not have a slice object drawn over it.
Property (read-only) or method Data type Notes top integer Top of the cell in pixels. The top starts at 0. width integer Width of the image in pixels, including 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” on page 89). For example, Slices[0][0] is the slice information for the first cell at row 0, column 0. The first array is rows; the second is columns.
Property (read-only) Data type Notes doSkipUndefined Boolean Set to true if Export Undefined Slices is not selected in Document Properties. imagesDirPath string Relative URL to the images folder. For example, "images/", or "../site_images", or "" (an empty string) if the images and the HTML are in the same directory. numColumns integer Number of columns in the HTML table. Does not include shim column. numRows integer Number of rows in the HTML table. Does not include shim row.
You can use the information in the following sections to return or set property values. N OT E The return value for a property may be null. Working with properties for any selected object You can get values for the following read-only properties of any type of selected object: ■ top ■ left ■ width ■ height ■ visible ■ opacity ■ blendMode ■ name ■ mask To return the name of the selected object, type the following code: objectName=fw.selection[0].
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). These specific properties are available for each of the following elements when the elements are selected.
Path ■ pathAttributes NO TE For the complete list of path attributes properties, see “pathAttributes” on page 97. ■ 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.
Text ■ antiAliased ■ antiAliasMode ■ autoKern ■ orientation ■ pathAttributes NO TE For the complete list of pathAttributes properties, see “pathAttributes” on page 97. ■ randSeed ■ textRuns ■ textureOffset ■ transformMode To return the antiAliasMode setting for the currently selected text block, type the following code: antiAliasedSetting = fw.selection[0].
pathAttributes Several objects have the pathAttributes property. The following list is the valid set of pathAttributes subproperties that can be returned or set: ■ brushColor ■ fillColor ■ brush ■ fill ■ brushTexture ■ fillTexture ■ fillHandle1 ■ fillHandle2 ■ fillHandle3 ■ brushPlacement ■ fillOnTop To return the name of brush on the current path, type the following code: brush = fw.selection[0].pathAttributes.brush.
3 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.
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. The RPC mechanism exposes the Fireworks JavaScript DOM through XML and a TCP socket connection.
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.
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 N OT E XML requests are specially formatted XML document fragments, not full XML documents. XML requests are sent to the server in UTF-8 encoding and terminated with the null (0) character.
■ The release operation informs the server that the client has finished working on the specified object. A release request must specify only an obj attribute and no subelements. In the following example, the client tells the server that it is has finished working on the object with ID 1: NO TE Each type of request requires an obj attribute, and all but the release request require a name attribute. Requests can be only of types get, set, func, or release.
Data node The data node is the most important type of XML node in RPC. Methods called through the func operation need to act on actual data or references to server objects identified in data 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. Data type Node name Example Description array array
Data type Node name Example Description null null The null type has only one value: 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. server object obj The server object data type. The value attribute is set to the object ID. The class attribute is optional.
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. If the request doesn’t require a return value, the reply node contains either a single void data node or no children nodes.
Error code Description 5 Read-only property. The set request cannot be completed because the specified property is read only. 6 Wrong number of parameters. The request did not specify the correct number of parameters. Either more or fewer parameters are needed. 7 Wrong parameter type. One or more of the parameters given is of the wrong type. 8 Security violation. The method is not allowed in RPC.
The following table shows the mapping between the Fireworks Object Model data types and the RPC data types. DOM data type RPC data type Example Description array array Types map identically. Boolean Boolean Both types are identical. Both contain only two values: true or false. color string A color is a string with nine characters. It has the format #RRGGBBAA.
DOM data type RPC data type Example Description object server object, or dictionary For an object type, the client can simply specify a server object. However, for certain objects (such as objects of the Effect class) a dictionary can be constructed and then used. If the client creates a dictionary, all properties of the class must be added to the dictionary with the correct type. point dictionary PAGE 110Security The RPC server restricts some operations to make sure that a client cannot use the RPC server maliciously to damage the user’s system. The first security mechanism is that the RPC server binds to the loopback address, 127.0.0.1. This means all clients must run on the same computer as the RPC server and must connect to that computer through the loopback address.
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.
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. Description Removes an object from the current auto-release pool so that it can be used in another code block. RPCMethods.ReleaseObject() Usage RPCMethods.
Here is an example: RPCMethods.CreateAutoReleasePool(); var selObject = fw.selection.get(0); RPCMethods.DestroyAutoReleasePool(); Calling the CreateAutoReleasePool() function marks the beginning of the auto-release block, and calling the DestroyAutoReleasePool() function marks the end. Any object allocated between these two calls is released by calling DestroyAutoReleasePool(). Using these two functions, you can write ActionScript code and not worry about memory management.
3. 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" 4. Create a simple button which will activate the RPC script. 5. Insert the button in the first frame, in the middle of the Stage. 6. Attach the following ActionScript code to the button to activate the RPC code when the button is clicked: on(press){ RPCMethods.
The SWF creates a new Fireworks document, and draws a 200 x 200 pixel green rectangle in Fireworks: 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.
How Flash panels and commands work Macromedia Flash developers can create interactive movies that contain a combination of ActionScript and calls to the Fireworks API for two types of deployment: interactive panels or modal commands. Basically, while writing ActionScript, you can embed commands for the Fireworks API in the MMExecute() function, or you can embed them using the API wrapper extension for Macromedia Flash (download the API wrapper from the Macromedia website at www.macromedia.
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. N OT E MMExecute supersedes the FWJavascript command. However, the FWJavascript command still works in the current version of Fireworks. The commands should be embedded in the same way that you would write separate JavaScript code blocks to perform similar operations, and you can concatenate lines of JavaScript code into one MMExecute() function.
Using the API wrapper extension in Macromedia Flash You can install a special extension that was developed specifically for writing Fireworks functions in ActionScript (currently, only ActionScript 1.0) either as a replacement for the MMExecute() and MMEndCommand() functions or to be used in conjunction with them. After it is installed, the API wrapper appears in the Macromedia Flash interface. This wrapper simplifies the writing of Fireworks commands.
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. ■ To improve the appearance and positioning of a modeless panel, turn off scaling and align the panel contents with the upper-left corner of the Stage.
Creating event handlers To create an event handler, implement a function with the corresponding event name. Currently, Fireworks supports the following events for Flash panels: Event Description onFwStartMovie Sent to the SWF file right after Fireworks has started (or restarted) the SWF file. onFwStopMovie Sent to the SWF file right before Fireworks stops the file (and possibly unloads it). onFwUnitsChange Sent when the user changes the type of units (inches, pixels, centimeters) in the Info panel.
Event Description onFWDocuementOpen Sent when the document is opened. onFWDocumentClosed Sent when the document is closed. onFWDocumentSave Sent when a save action is performed in the document. 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. onFwPixelSelectionChange Sent when the pixel selection changes.
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()” on page 312 and “fw.disableFlashDebugging()” on page 311). Use the Flash debugging functions to show or hide everything that the Shockwave file passes to the Fireworks API during execution.
4 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. For example, a spiral shape consists of relationships among several smaller objects.
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.
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.
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++; // Establish the new control point var cp=smartShape.elem.controlPoints[smartShape.elem.controlPoints.
■ "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 true). For more information, see “SmartShape object” on page 75. ■ "EndDragControlPoint" Fireworks sends this message when the drag operation is complete.
Function Description DragInsert() This function is called every time the mouse moves during a drag operation (as long as smartshape.getsDragEvents is set to true). See “SmartShape object” on page 75. EndDragInsert() This function is called on a mouse-up event after a drag operation. BeginDragControlPoint() Tells Fireworks what to do when the user clicks and holds the mouse button on a control point.
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 switch() statement. Switch statements If you take a look at some existing Auto Shapes (in the Configuration/Auto Shapes folder and in the Configuration/Auto Shape Tools folders), you’ll notice a switch() statement near the beginning of the file.
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.
5 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. Using Fireworks API functions Three categories of API functions are described in this chapter: Document functions, History panel functions, and Fireworks 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. Palette or panel Several API functions reference the History panel (see “History panel functions” on page 350).
Arguments A string that specifies the behavior to be added, such as For a list of all the behaviors that can be added, see “Using the dom.addBehavior() function” on page 133. action "MM_swapImageRestore()". event The event that triggers the behavior. Acceptable values are "onMouseOver", and "onClick". "onMouseOut", "onLoad", An integer value that specifies the location where the behavior should be added, starting with 0 (although, to specify the end location, pass –1 here).
Arguments type, barName, target, swapFrame, fileName, preload ■ Pass "down" for type. ■ Pass "navbar1" for the name of the navigation bar. ■ target specifies the slice to which the behavior is attached. Pass –1 for this value; all other values are used internally by Fireworks. ■ swapFrame is an integer value that specifies the frame to swap, starting with 0 (although, to use fileName as a URL, pass –1 here). ■ fileName specifies the frame or file to swap.
■ preload is a binary value that specifies whether to preload the swapped image (pass 1) or not (pass 0). ■ downHighlight ■ is an integer value that specifies the frame to use as a highlight image, starting with 0 (although, to use downHighlightFrame as a URL, pass –1 here). ■ specifies the frame or file to be used as the highlight image. If you specified a frame to use in downHighlightFrame, pass an empty text string.
MM_nbGroup [out] Availability Fireworks 3. Arguments type Pass "out" for type. Description Sets a navigation bar restore behavior. Example fw.getDocumentDOM().addBehavior("MM_nbGroup(\'out\')", "onMouseOut", -1); MM_simpleRollover Availability Fireworks 3. Arguments None. Description Adds a simple rollover behavior. Example fw.getDocumentDOM().addBehavior("MM_simpleRollover()", "onMouseOver", -1); MM_statusMessage Availability Fireworks 3.
Example fw.getDocumentDOM().addBehavior("MM_statusMessage(\"Status Message!\")", "onMouseOver", -1); MM_swapImage Availability Fireworks 3. Arguments target, swapFrame, fileName, preload, restoreOnMouseOut specifies the slice to which the behavior is attached. Pass –1 for this value; all other values are used internally by Fireworks. ■ target ■ swapFrame is an integer value that specifies the frame to swap, starting with 0 (although, to use fileName as a URL, pass –1 here).
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 mode are "reveal all", "hide all", "reveal selection", and "hide selection".
Arguments howMany where An integer that specifies how many frames to add. The location where frames should be added. Acceptable values for where are and "end". "beginning", "before current", "after current", Added in Fireworks 4, specifies whether to change the active frame. If it is omitted or true, this function sets the active frame to the first frame added. If false, the active frame does not change.
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 hotspot-kind hotspot-shape Acceptable values are "hotspot" and "slice". Acceptable values are "rectangle" and "oval".
Arguments A rectangle that specifies the bounds of the image to be added (see “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. boundingRectangle If bEnterPaintMode is true, the application immediately enters bitmap mode for the new image. bEnterPaintMode Returns Nothing.
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. The selection is cut from the previously active bitmap. The new bitmap appears with Fireworks in paint mode. dom.addNewLayer() Availability Fireworks 3. Usage dom.
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 is added (see “Point data type” on page 12). startPoint and endPoint Returns Nothing. Description Adds a new path between two points.
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}); dom.addNewRectangle() Availability Fireworks 3. Usage dom.
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 primitive is added (see “Rectangle data type” on page 12). boundingRectangle A floating-point value between 0 and 1 that specifies the “roundness” to use for the corners (0 is no roundness, and 1 is 100% roundness). roundness Returns Nothing.
dom.addNewSinglePointPath() Availability Fireworks 3. Usage dom.addNewSinglePointPath(controlPointFirst, controlPointLast, bCopyAttrs) Arguments Points that specify the x,y 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). controlPointFirst, mjainPoint, and controlPointLast If bCopyAttrs is false, the path’s stroke and fill are copied directly from the document’s current stroke and fill settings.
Arguments numSides An integer that specifies the number of sides of the new path. spikiness A floating-point value that controls the regularity of the star or polygon. Pass -1 to have Fireworks calculate a good value, or pass a value between 0 and 1 for manual control. If bIsStar is true, a star with the specified number of points is created. If it is a regular polygon with the specified number of sides is created.
Description Adds a new symbol to the library and opens the symbol document for editing. Optionally adds an instance of the symbol to the document. Example The following command adds a new graphic symbol called text to the library and places an instance of it in the document: fw.getDocumentDOM().addNewSymbol("graphic", "text", true); dom.addNewText() Availability Fireworks 3. Usage dom.
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 swap image behavior to be added (see “Point data type” on page 12). where Returns if the swap image behavior was added; false if no suitable Hotspot was at the specified location.
bOkToIncreaseSize Specifies whether the export file size can be increased. ■ If bOkToIncreaseSize is true, and the current size is less than sizeInBytes, the argument increases the quality of the export settings as much as possible, making the export size larger if necessary. ■ If bOkToIncreaseSize is false, the argument increases the quality of the export settings as much as possible without increasing the export size. Description Adjusts the export settings as specified. dom.
Arguments alignmode Acceptable values are "left", "right", "top", "bottom", and "center horizontal". "center vertical", alignToCanvas Boolean. Determines if the alignment is to the canvas or items. The default value is false. Returns Nothing. Description Aligns the selection. dom.appendPointToHotspot() Availability Fireworks 3. Usage dom.appendPointToHotspot(pt, tolerance) Arguments A point that specifies the x,y coordinates of the point to be added (see “Point data type” on page 12).
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 point is appended. For paths with multiple contours, the contours are in an arbitrary order. contourIndex A zero-based index value that specifies where on the path the new point should be placed.
Arguments A point that specifies the x,y coordinates of the point to be added (see “Point data type” on page 12). pt A floating-point value > = 0 that specifies the tolerance between the new point and the starting point of the polyline path. If the new point is within tolerance of the starting point, the polyline path is closed. tolerance Returns Nothing. Description Appends a point to the selected unclosed polygon slice.
Arguments bNoNullFills If bNoNullFills is true and the current fill is None, then a default fill is 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); dom.applyEffects() Availability Fireworks 3. Usage dom.ApplyEffects(effectList) Arguments An EffectList object (see “EffectList object” on page 48).
dom.applyFontMarkup() Availability Fireworks 3. Usage dom.applyFontMarkup(fontAttribute, value) Arguments fontAttribute Acceptable values for fontAttribute are "size" and "face". value If fontAttribute is "size", value must be of the form "XXXpt" to specify a point size; a simple numeric value is not allowed. Returns Nothing. Description Applies the specified font markup attribute to the selected text. dom.applyStyle() Availability Fireworks 3. Usage dom.
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 arrangemode Acceptable values for arrangemode are "back", "backward", "forward", and "front". Returns Nothing. Description Arranges the selection. Example The following command brings the selected items to the front: fw.getDocumentDOM().
Description Attaches the selected text to the selected path. If no text and path are selected, no action occurs. Example When two items are selected (one a text block and the other a shape), the following command attaches the text block to the shape’s path: fw.getDocumentDOM().attachTextToPath(); dom.changeGuide() Availability Fireworks 3. Usage dom.
dom.changeSliceGuide() Availability Fireworks MX. Usage dom.changeSliceGuide(currentPosition, newPosition, guidekind, isMagneticDrag, isSingleDrag) Arguments currentPosition A floating-point value that specifies the current position of the slice guide to be moved. newPosition A floating-point value that specifies the new position of the slice guide. Acceptable values are "horizontal" and "vertical".
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().
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 format The graphics format for the selection.
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.
whatIfPastingIntoElementMask An optional argument, added in Fireworks 4, that 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). If the image mask isn’t empty, the pasted elements are added to the existing mask, rather than replacing it. Acceptable values for whatIfPastingIntoElementMask are "image", "vector", and "ask user".
Acceptable values for maskReplaceOptions are "replace" (if an element mask already exists, replace it with the pasted one), "add" (if an element mask already exists, add the pasted mask to it), and "ask" (displays a dialog box to let the user decide). maskReplaceOptions Returns Nothing. Description Pastes the Clipboard contents into the document as an element mask. Only one element can be selected when calling this function.
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 and the fromChannel is pasted in to all three color channels of the new bitmap, resulting in a grayscale image. This first argument is ignored if the current selection is not a single bitmap.
Arguments whatIfResolutionDifferent An optional string that specifies how resampling should be done if the resolution of the Clipboard contents doesn’t match the resolution of the document. Acceptable values for whatIfResolutionDifferent are "resample", "do not resample", and "ask user" (displays a dialog box to let the user decide). If whatIfResolutionDifferent is omitted or null, "ask user" is assumed. Returns Nothing.
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 If bPromptToSaveChanges is true, and the document was changed since the last time it was saved, the user is prompted to save any changes to the document. If bPromptToSaveChanges is false, the user is not prompted, and changes to the document are discarded.
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. Usage dom.convertPathToMarquee(mode, featherAmount) Arguments mode Sets the mode.
Description Converts path to marquee selection. dom.convertToAnimSymbol() Availability Fireworks 4. Usage dom.convetToAnimSymbol(name, numFrames, offsetDistPt, rotationAmount, scaleAmount, startOpacity, endOpacity) Arguments name A string that specifies a name for the new animation symbol. numFrames An integer that specifies the number of frames through which the symbol animates. A point that specifies the distance the animation will move in pixels (see “Point data type” on page 12).
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 type Acceptable values are "graphic", "button", and "animation". name A name for the new symbol.
Example The following command creates a graphic symbol from the selected item and names it “star”: fw.getDocumentDOM().convertToSymbol("graphic", "star"); See also dom.convertToAnimSymbol(), dom.convertAnimSymbolToGraphicSymbol() dom.convolveSelection() Availability Fireworks MX 2004. Usage dom.convolveSelection( kernelWidth, kernelHeight, kernelValues, affectsAlpha) Arguments kernelWidth An integer that defines the width of the filter coefficients.
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 hotspotType Acceptable values are "hotspot" and "slice".
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. Usage dom.cropSelection(boundingRectangle) Arguments A rectangle that specifies the bounds within which the selection should be cropped (see “Rectangle data type” on page 12).
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, starting with 0 (although, to specify the current frame, pass –1). frameIndex howMany Specifies how many frames to delete. Returns Nothing. Description Deletes one or more frames. dom.deleteLayer() Availability Fireworks 3. Usage dom.
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 deleted, starting with 0 (although, to specify the current contour, pass –1 here).
Arguments This argument is ignored if Fireworks is not in bitmap mode. If Fireworks is in bitmap mode and bFillDeletedArea is true, the deleted pixels are filled with the current fill color. If false, the deleted pixels are filled to transparent. bFillDeletedArea Returns Nothing. Description Deletes the selection or the pixel selection if Fireworks is in bitmap mode. Example If Fireworks is not in bitmap mode, the following command deletes the selected items.
dom.deleteSymbol() Availability Fireworks 3. Usage dom.deleteSymbol(symbolName) Arguments symbolName The name of the symbol to delete from the library. If more than one symbol 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. Returns Nothing. Description Deletes the specified symbols from the library.
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 distributeToCanvas parameter in Fireworks 8. Usage dom.distribute(distmode, distributeToCanvas) Arguments distmode Acceptable values are "vertical" and "horizontal".
dom.distributeLayerToFrames() Availability Fireworks 3. Usage dom.distributeLayerToFrames(layerIndex) Arguments An integer value that specifies the layer that contains the items to be distributed, starting with 0 (although, to specify the current layer, pass –1 here). layerIndex Returns Nothing. Description Distributes the items on the specified layer to the frames of the document, adding frames if necessary.
dom.dragControlPoint() Availability Fireworks MX 2004. Usage dom.dragControlPoint(index, newLoc, shiftKeyDown, ctrlCmdKeyDown, altOptKeyDown) Arguments index The index of the control point to move. newLoc Specifies the new location of the point. shiftKeyDown Specifies whether the Shift key is pressed. ctrlCmdKeyDown Specifies whether the Control key (Windows) or Command key (Macintosh) is pressed. altOptKeyDown Specifies whether the Alt key (Windows) or Option key (Macintosh) is pressed.
Acceptable values are "beginning", "before current", "after and "end". where current", If bDupeSelectionOnly is true, only items in the specified frame that are selected are duplicated to the new frame. bDupeSelectionOnly 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); dom.duplicateLayer() Availability Fireworks 3.
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(); See also dom.
Arguments frameIndexFirst and frameIndexLast Integer values that specify the range of frames (inclusive) to which the items should be copied, starting with 0 (although, to specify the current frame, pass –1 here). ■ 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. Returns Nothing. Description Duplicates the selection to a range of frames of the document. dom.
Arguments symbol The symbol to duplicate. ■ To duplicate all selected symbols in the library (not the document), pass a null value. ■ Duplicating a linked symbol results in a nonlinked duplicate. Returns Nothing. Description Duplicates the specified symbol. dom.duplicateSymbolForAlias() Availability Fireworks 3. Usage dom.duplicateSymbolForAlias() Arguments None. Returns Nothing.
Arguments where Specifies which rectangle to check for elements. To find the elements under a single point (similar to selecting with the Subselection tool), set left equal to right and top equal to bottom. To find elements within a rectangle (similar to drag-selecting with the Pointer tool), set the values to the desired rectangle. Returns An array of zero of more elements. Description Returns a list of zero or more elements at the given location.
dom.enableTextAntiAliasing() Availability Fireworks MX. Usage dom.enableTextAntiAliasing(antiAlias) NO TE To set the level of anti-aliasing, call the function dom.setTextAntiAlisasing() (see “dom.setTextAntiAliasing()” on page 291). Arguments antiAlias A Boolean value to turn anti-aliasing on (true) or off (false). Returns Nothing. Description Turns anti-aliasing on or off for the selected blocks of text. dom.enterElementMaskEditMode() Availability Fireworks 4. Usage dom.
dom.enterPaintMode() Availability Fireworks 3, with the argument newSelectionMask added in Fireworks MX. Usage dom.enterPaintMode({newSelectionMask}) Arguments An optional bitmap selection mask. When newSelectionMask is not null, the selection is set on the currently selected bitmap after entering paint mode. This argument is null by default. newSelectionMask Returns Nothing. Description Enters image edit mode on the selected items.
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 fileURL A string, which is expressed as a file://URL, that specifies the GIF or ACT file that is used to replace the color panel.
dom.exportOptions.saveColorPalette() Availability Fireworks 3. Usage dom.exportOptions.saveColorPalette(fileURL) Arguments fileURL A string, which is expressed as a file://URL, that specifies the name of the file to which the color panel should be saved. Do not specify a file extension; the .act extension is added automatically. Returns Nothing. Description Saves the values in dom.exportOptions.paletteEntries to the specified color panel (ACT file). This function does not modify the document.
Description Exports the document as specified. dom.fillSelectedPixels() Availability Fireworks 3. Usage dom.fillSelectedPixels(clickPt, p1, p2, p3, bFillSelectionOnly, tolerance, edgemode, featherAmt) Arguments clickPt A point that specifies the x,y coordinates of the pixel to be filled or generated (see “Point data type” on page 12). p1, p2, and p3 Points that specify the fill-vector. These arguments are ignored if the current fill does not use a fill-vector.
dom.filterSelection() Availability Fireworks 3. usage dom.filterSelection(LiveEffect) Arguments LiveEffect An Effect object (see “Effect object” on page 41). Returns Nothing. Description Applies the specified pixel filter to the selection. Items that are not images are converted into images before the filter is applied. Only external filters that are capable of also being Live Effects can be applied using this function. To apply other types of external filters, use dom.filterSelectionByName().
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 dom.filterSelection().) This function always displays a dialog box. dom.filterSelectionByName() Availability Fireworks 3. Usage dom.filterSelectonByName(category, name) Arguments A string that specifies the category of the pixel filter to be applied. Acceptable values depend on which filters you have installed.
Arguments A case-sensitive string that specifies the exact element name to find. To specify elements that have no name, pass null. name Returns An array of elements that have the specified name, or null if no objects have the specified name. Description Looks for elements that have the specified name. See also dom.setElementName() dom.flattenDocument() Availability Fireworks 3. Usage dom.flattenDocument() Arguments None. Returns Nothing.
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 fontAttribute Acceptable values for fontAttribute are "size", "color", and "face". Returns A string that specifies the markup value. Returns null if the text has multiple attributes or if the selection contains no text.
Returns The mask for the current pixel selection. Returns null if Fireworks is not in bitmap mode, or if there is no pixel selection. For information on the format of mask variables, see “Mask data type” on page 11. Description Gets the current pixel-selection mask. The result of this call could be used to call “dom.enableElementMask()” on page 184 or “dom.enterPaintMode()” on page 186. dom.getSelectionBounds() Availability Fireworks 3. Usage dom.getSelectionBounds() Arguments None.
Description Determines whether the grid is visible. dom.getShowGuides() Availability Fireworks 8. Usage dom.getShowGuides() Arguments None. Returns true if the guides are visible; false otherwise. Description Determines if the guides are visible. dom.getShowRulers() Availability Fireworks 3. Usage dom.getShowRulers() Arguments None. Returns true if the rulers are visible; false otherwise. Description Determines whether the rulers are visible.
dom.getSnapToGuides() Availability Fireworks 8. Usage dom.getSnapToGuides() Arguments None. Returns true if the Snap to Guides function is available; false otherwise. Description Determines if the Snap to Guides function is available. dom.getSnapToGrid() Availability Fireworks 3. Usage dom.getSnapToGrid() Arguments None. Returns true if the Snap to Grid function is active; false otherwise. Description Determines whether the Snap to Grid function is active. dom.
Arguments None. Returns One of the following strings: "left", "center", "right", "justify", "stretch", "vertical left", "vertical center", "vertical right", "vertical justify", or "vertical stretch". Returns null if the text has multiple alignments or if the selection contains no text. Description Gets the alignment of selected text. dom.group() Availability Fireworks 3, argument deprecated in 4. Usage dom.group({type}) Arguments An optional string that specifies how to group the items.
dom.hasCharacterMarkup() Availability Fireworks 3, updated in Fireworks 4. Usage dom.hasCharacterMarkup(tag) Arguments tag Acceptable values are "b", "i", and "u", for bold, italic, and underline; and "fwplain", which was added in Fireworks 4, for text without character markup. Returns if the text has the specified character markup; false if it does not or if only part of the text has the markup. true Description Determines whether the selected text has the specified character markup. dom.
dom.importFile() Availability Fireworks 3. Usage dom.importFile(fileURL, boundingRectangle, bMaintainAspectRatio) Arguments fileURL The filename of the file to be imported, which is expressed as a file://URL. A rectangle that specifies the size to make the imported file (see “Rectangle data type” on page 12). If boundingRectangle is specified with left == right and top == bottom, the file is brought in unscaled with its top-left corner at the specified location, and the third argument is ignored.
Arguments fileURL The name of the file to be imported into the library, which is expressed as a file:// URL. If bAddToDoc is true, the symbol is added to the library and an instance of the symbol is inserted into the center of the document. If it is false, the symbol is added only to the library. bAddToDoc If bAllowUI is true, and fileURL is a Fireworks document that contains symbols, then a dialog box lets the user specify which symbols to import from the external file.
This function is similar to the dom.importSymbol API. dom.importSymbol places an instance of a symbol in your document—for example, when you select Edit > Libraries > Buttons, and dom.importSymbolButNotAsAlias extracts the component elements from the selected symbol and places copies of those elements in the document. dom.importSymbolButNotAsAlias does not place in an instance in the document. dom.inLaunchAndEdit() Availability Fireworks MX. Usage dom.inLaunchAndEdit() Arguments None.
A floating-point value between 0 and 1 that specifies where to insert the new point in the Bézier segment. tParameter and controlPointLast Points that specify the x,y coordinates of the preceding control point, the main point, and the following control point of the new point (see “Point data type” on page 12). controlPointFirst, mainPoint, Returns Nothing. Description Inserts a Bézier point in the selected path. This function is similar to dom.
dom.insertSymbolAt() Availability Fireworks 8. Usage dom.insertSymbolAt(uiName, locationPoint) Arguments uiName The name of the symbol in the library. If more than one symbol exists with the specified name, Fireworks inserts the first symbol named. locationPoint The center of the symbol expressed as x, y coordinates. Returns Nothing. Description Inserts a symbol instance at the specified location. dom.isSelectionDirectlyAboveBitmapObject() Availability Fireworks MX. Usage dom.
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 data type” on page 12). from tolerance A floating-point value > = 0 that specifies the tolerance within which items are cut.
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 started to drag (see “Point data type” on page 12). from A point that specifies the x,y coordinates of the point where the user ended the drag operation. to tolerance A floating-point value > = 0 that specifies the tolerance within which items are cut.
An integer value that specifies the element, starting with 0 (although, to specify the current element, pass –1 here). element If bLink is true, the element masks are linked to their elements; if false, they are unlinked from their elements. bLink Returns Nothing. Description Links or unlinks the element mask on the selected element. If more than one element (or no elements) are selected when this function is called, Fireworks throws an exception.
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 None. Returns Nothing.
Description Merges selected objects to the bitmap directly below the selected objects. Succeeds only if the object immediately below the selection is a bitmap. For more information, see “dom.isSelectionDirectlyAboveBitmapObject()” on page 203. dom.modifyPointOnPath() Availability Fireworks 3. Usage dom.
Arguments typeStr "radial", A string that specifies the type of blur to apply. Valid values are "linear", and "zoom". angle An integer between 0 and 359 that specifies in degrees the direction of the blur, similar to the drop shadow effect angle. A floating-point value between 0 and 400 that specifies in pixels how far from the original image the blur effect will extend. distance An integer that defines the number of times the original image is cloned and blurred to produce the desired effect.
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 moved (see “Point data type” on page 12). For example, passing ({x:1,y:2}) moves the element masks 1 pixel to the right and 2 pixels down. delta Returns Nothing.
Specifies which handle to move and can be one of the following values: or "rotate2". (Some fills ignore "end2".) Use "rotate1" or "rotate2" to rotate the end1 or end2 point around the start point. whichHandle "start", "end1", "end2", "rotate1", bConstrain If the value of bConstrain is true, movement is constrained to 45º increments. bMoveJustOne If the value of bMoveJustOne is true, only the specified handle moves. If it is false, other handles might move in sync when the specified handle is moved.
dom.movePixelMaskBy() Availability Fireworks 4. Usage dom.movePixelMaskBy(delta) Arguments A point that specifies the x,y coordinate values by which the bitmap mode selection is moved (see “Point data type” on page 12). For example, passing ({x:1,y:2})moves the bitmap mode selection 1 pixel to the right and 2 pixels down. delta Returns Nothing. Description Moves a bitmap mode selection by the specified amount, without moving the pixels that are within the selection. dom.
dom.movePointOnHotspotByWithFlags() Availability Fireworks MX. Usage dom.MovePointOnHotspotByWithFlags(ptToModifyIndex, delta, flags) Arguments ptToModifyIndex A zero-based index that specifies which point on the path is to move. delta A point that specifies the x-,y-coordinate values by which the point is moved (see “Point data type” on page 12). For example, passing ({x:1,y:2}) moves the point 1 pixel to the right and 2 pixels down.
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 “Point data type” on page 12).
Arguments delta A point that specifies the x-,y-coordinate values by which the mask is moved (see “Point data type” on page 12). For example, passing ({x:1,y:2}) moves the mask 1 pixel to the right and 2 pixels down. Returns Nothing. Description Moves the current pixel mask by the specified amount. If there is no pixel selection, an exception is thrown. dom.moveSelectionTo() Availability Fireworks 3. Usage dom.
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 copied, starting with 0 (although, to specify the current frame, pass –1 here). frameIndex bMakeCopy If bMakeCopy is true, the selection is copied instead of moved. Returns Nothing. Description Moves or copies the selection to the specified frame. dom.
A zero-based index, added in Fireworks 4, that specifies the element before which the moved or copied selection should be inserted. If elementIndex is omitted, the 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 0 is the topmost, and (n-1) is the last element (for a layer with n elements).
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 miter A floating-point value that specifies the new miter angle of the selected paths, in pixels. This argument is ignored if the value of join is not "miter". cap Acceptable values are "butt", "square", and "round".
join Acceptable values are "bevel", "round", and "miter". Returns Nothing. Description Performs an inset operation on the selected paths. dom.pathIntersect() Availability Fireworks 3. Usage dom.pathIntersect() Arguments None. Returns Nothing. Description Performs an intersect operation on the selected paths. dom.pathPunch() Availability Fireworks 3. Usage dom.pathPunch() Arguments None. Returns Nothing. Description Performs a punch operation on the selected paths.
dom.pathSimplify() Availability Fireworks 3. Usage dom.pathSimplify(limit) Arguments limit is a floating-point value that specifies how much to simplify. This value corresponds to the value in the Modify > Alter Path > Simplify dialog box. Returns Nothing. Description Performs a simplify operation on the selected paths. dom.pathUnion() Availability Fireworks 3. Usage dom.pathUnion() Arguments None. Returns Nothing. Description Performs a union operation on the selected paths.
dom.previewInBrowser() Availability Fireworks MX. Usage dom.previewInBrowser(primaryBrowser) Arguments primaryBrowser A Boolean value that specifies which browser Fireworks should start: the primary browser (true) or the secondary browser (false). Returns Nothing. Description Previews the document in the primary or secondary browser. dom.rebuildColorTable() Availability Fireworks 3. Usage dom.rebuildColorTable() Arguments None. Returns Nothing.
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.
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 If bHoriz is true, the items are reflected horizontally. bHoriz bVert opts If bVert is true, the items are reflected vertically.
dom.removeAllGuides() Availability Fireworks 3. Usage dom.removeAllGuides(guidekind) Arguments guidekind Acceptable values are "horizontal" and "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 is ignored by Fireworks.
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 tag Acceptable values are "b", "i", and "u", for bold, italic, and underline. Returns Nothing.
dom.removeElementMask() Availability Fireworks 4. Usage dom.removeElementMask(whatIfElementIsAnImage) Arguments whatIfElementIsAnImage This argument is used only if the element (not the element mask) is an image. Acceptable values for whatIfElementIsAnImage are "apply" (apply the element mask to the image before discarding the element mask), "discard" (discard the element mask), and "ask" (displays a dialog box to let the user decide).
dom.removeFill() Availability Fireworks 3. Usage dom.removeFill() Arguments None. Returns Nothing. Description Sets the fill of the selection to None. dom.removeGuide() Availability Fireworks 3. Usage dom.removeGuide(position, guidekind) Arguments position A floating-point value that specifies the position of the guide to be removed. Acceptable values are "horizontal" and "vertical". If guidekind is coordinate; if guidekind is "vertical", it is assumed that position is an x coordinate.
dom.removeTransformation() Availability Fireworks 3. Usage dom.removeTransformation() Arguments None. Returns Nothing. Description Removes the transformations, if any, from the selected text or instances. dom.reorderFrame() Availability Fireworks 3. Usage dom.reorderFrame(frameToMove, frameToPutItBefore, bMakeCopy) Arguments frameToMove A zero-based index that specifies which frame to move or copy.
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 moved or copied.
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. Usage dom.replaceButtonTextStringsInInstances(newString, uniformAttrs) Arguments newString Specifies the string to be used as replacement text.
dom.replaceTextString() Availability Fireworks 3. Usage dom.replaceTextString(newString, uniformAttrs) Arguments newString Specifies the string to be used as replacement text. If uniformAttrs is false, each character retains the attributes of the character that was formerly in its position; that is, Fireworks preserves the existing formatting. If uniformAttrs is true, all characters assume the attributes of the first character in the string that is being replaced. uniformAttrs Returns Nothing.
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 selectionName User-specified name of the selection to restore. If selection name is not specified, the selection named "default" will be restored.
Returns true if the selection is inverted; otherwise 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. Usage dom.
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 rotationDegrees A floating-point value that specifies the number of degrees to rotate the selection. Acceptable values are "transformAttributes", "autoTrimImages", and "autoTrimImages transformAttributes". opts Returns Nothing.
Description Saves the document in its default location. After a successful save operation, the document’s isDirty property is cleared. dom.saveCopyAs() Availability Fireworks 3. Usage dom.saveCopyAs(fileURL) Arguments A string, which is expressed as a file://URL, that specifies the directory and name under which the copy should be saved. fileURL Returns true if the save operation is successful; false otherwise. Description Saves a copy of the document in a specified directory with a specified name.
Description Stores the current selection in bitmap mode as the “Selective JPEG mask”. Use dom.restoreJPEGMask() to restore the JPEG mask. 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 "default".
dom.scaleSelection() Availability Fireworks 3. Usage dom.scaleSelection(xScaleAmount, yScaleAmount, opts) Arguments xScaleAmount and yScaleAmount Float values that specify the amount to scale the selection in the horizontal and vertical axes. Acceptable values are 0.0 or greater; a value of 1 represents 100%, 2 represents 200%, and so on. Acceptable values are "transformAttributes", "autoTrimImages", and "autoTrimImages transformAttributes". opts Returns Nothing.
Arguments whatToDo Acceptable values are "expand", "contract", "border", and "smooth". ■ Use "expand" to expand the pixel selection outward by the number of pixels that are specified by amount. ■ Use "contract" to reduce the pixel selection inward by the number of pixels that are specified by amount. ■ Use "border" to select a band of pixels the width of amount around the edge of the pixel selection. ■ Use "smooth" to smooth out the edge of the pixel selection by amount.
dom.selectAllOnLayer() Availability Fireworks MX. Usage dom.selectAllOnLayer(layerIndex, bRememberSelection, bToggleSelection) Arguments layerIndex A long integer that identifies the layer on which to select the element. bRememberSelection A Boolean value. If true, all the elements on the layer are appended to the current selection. A Boolean value. Toggles the selection of elements instead of simply selecting them. This parameter is useful only if bRememberSelection is true.
See also dom.selectParents() dom.selectFeather() Availability Fireworks 3. Usage dom.selectFeather(featherAmount) Arguments featherAmount An integer that specifies the number of pixels by which to feather the 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. dom.selectInverse() Availability Fireworks 3. Usage dom.selectInverse() Arguments None. Returns Nothing.
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. Usage dom.selectParents() Arguments None. Returns Nothing. Description Selects the parents, if any, of the selection.
dom.selectSimilar() Availability Fireworks 3. Usage dom.selectSimilar(tolerance, edgemode, featherAmt, combinemode) Arguments tolerance An integer between 0 and 255, inclusive, that specifies the tolerance for selecting pixels. edgemode Acceptable values are "hard edge", "antialias", and "feather". An integer that specifies the number of pixels to feather. This value is ignored if edgemode is not "feather". featherAmt combinemode Specifies how to combine the new selection mask with the existing mask.
Arguments A point that specifies the x,y coordinates of the pixel whose color is used to calculate the new mask (see “Point data type” on page 12). where tolerance An integer between 0 and 255, inclusive, that specifies the tolerance for selecting pixels. edgemode Acceptable values are "hard edge", "antialias", and "feather". featherAmt An integer that specifies the number of pixels to feather. This value is ignored if edgemode is not "feather".
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 If bDisclosed is true, all the elements on all layers appear in the Layers list. If only layer names appear on the list. bDisclosed false, Returns Nothing.
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 numFrames An integer that specifies the number of frames through which the symbol animates. Returns Nothing. Description Sets the number of frames to animate the currently selected animation element. See also dom.convertToAnimSymbol() dom.
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 the animation symbol. For example, passing 720 specifies an animation that does two complete clockwise rotations.
Arguments A positive floating-point value that specifies the amount of scaling to be applied to the animation symbol. For example, pass 50 to scale the symbol to 50% of its current size, and pass 200 to scale it to twice its current size. To specify no scaling, pass 100. scaleAmount Returns Nothing. Description Sets the scale amount to animate the currently selected animation instance. See also dom.convertToAnimSymbol() dom.setAnimInstanceStartEndOpacity() Availability Fireworks 4. Usage dom.
dom.setAnimInstanceStartFrame() Availability Fireworks 3, deprecated in 4 in favor of placing the animation symbol on the frame in which it should start. Usage dom.setAnimInstanceStartFrame(startFrame) Arguments An integer that corresponds to the starting frame value that appears in the Objects panel when a multiframe image instance is selected. startFrame Returns Nothing. Description Sets the start frame of the selected instances of multiframe image symbols. dom.
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 color A color string (see “Color string data type” on page 11). Returns Nothing.
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 currentName newName A string that specifies the current name of the brush. A string that specifies the new name of the brush. Returns Nothing. Description Renames a brush. Does not change the brush category. dom.setBrushNColor() Availability Fireworks 3. Usage dom.
dom.setBrushNColorNTexture() Availability Fireworks 3. Usage dom.setBrushNColorNTexture(brush, color, texture-name) Arguments brush A Brush object (see “Brush object” on page 33). color A color string (see “Color string data type” on page 11). texture-name The name of the texture to be applied. Returns Nothing. Description Sets the selection to the specified brush, brush color, and brush texture. See also dom.setBrushColor() dom.setBrushPlacement() Availability Fireworks 3. Usage dom.
dom.setButtonAutoSlice() Availability Fireworks 3. Usage dom.setButtonAutoSlice(bAutoSlice) Arguments bAutoSlice If bAutoSlice is true, automatic slicing is turned on. If bAutoSlice is false, it is turned off. Returns Nothing. Description If the user is editing a Button document, this function turns automatic slicing on or off. dom.setButtonIncludeDownState() Availability Fireworks 3. Usage dom.
dom.setButtonIncludeOverWhileDownState() Availability Fireworks 3. Usage dom.setButtonIncludeDownState(bIncludeOverWhileDownState) Arguments If bIncludeOverWhileDownState is true, the OverWhile-Down state is included in the button. If bIncludeOverWhileDownState is false, it is not. bIncludeOverWhileDownState Returns Nothing. Description If the user edits a Button document, this function specifies whether to include the OverWhile-Down state in a button. dom.
dom.setButtonOptions() Availability Fireworks 3. Usage dom.setButtonOptions(exportOptions, URLString, altTagString, targetTagString, sliceName, statusMessage) Arguments exportOptions URLString An ExportOptions object (see “ExportOptions object” on page 58). A string that specifies the URL for the button(s). altTagString and targetTagString Specify the text for the button alt tag and target tag. A string that specifies the name to be assigned to the slice that is associated with the button.
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 color A color string (see “Color string data type” on page 11). Returns Nothing.
dom.setDocumentCanvasSize() Availability Fireworks 3. Usage dom.setDocumentCanvasSize(boundingRectangle) Arguments boundingRectangle A rectangle that specifies the new canvas size for the document, in pixels (see “Rectangle data type” on page 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().
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); See also dom.setDocumentCanvasSizeToSelection() dom.setDocumentCanvasSizeToSelection() Availability Fireworks 3. Usage dom.
Arguments boundingRectangle A rectangle that specifies the size to which the document should be scaled (see “Rectangle data type” on page 12). resolution Specifies the resolution for the scaled document (see “Resolution data type” on page 12). Returns Nothing. Description Scales the document to fit in the specified rectangle at the specified resolution. dom.setDocumentResolution() Availability Fireworks 3. Usage dom.
Arguments A string that defines the name of the category of the effect. category oldName The existing name of the effect. newName The new name to give to the effect. Returns Nothing. Description Sets the name for the current effect. dom.setElementLocked() Availability Fireworks 8. Usage dom.setElementLocked(frameNum, layerNum, objectIndex, bLock, bAllLayers, bLockLayers) Arguments A zero-based integer that specifies the frame that contains the element or elements to be locked.
dom.setElementLockedByName() Availability Fireworks 8. Usage dom.setElementLockedByName(name, bLock) Arguments name A string that specifies the name of the element or elements to be locked or unlocked. If more than one element has the same name, the function locks or unlocks all of them. A Boolean value. If true, the element or elements are locked; if false, they are unlocked. bLock Returns An array of the elements for which the lock status is set.
Description Sets the rendering mode on the selected element’s element mask. Only one element can be selected when calling this function. If more than one element (or no elements) are selected when this function is called, Fireworks throws an exception. Fireworks also returns an error if the selected element has no element mask. dom.setElementMaskShowAttrs() Availability Fireworks 4. Usage dom.
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 shown or hidden, starting with 0 (although, to specify the current frame, pass –1 here).
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 one element has the same name, this function shows or hides all of them. name bShow If bShow is true, the elements are visible. If bShow is false, they are hidden. Returns An array of the elements(s) for which visibility was set. Description Shows or hides all the elements with the specified name.
dom.setExportSettings() Availability Fireworks 3. Usage dom.setExportSettings(exportSettings) Arguments exportSettings An ExportSettings object (see “ExportSettings object” on page 61). Returns Nothing. Description Sets the document export settings. dom.setFill() Availability Fireworks 3. Usage dom.setFill(fill) Arguments fill A Fill object (see “Fill object” on page 64). Returns Nothing. Description Sets the selection to the specified fill. dom.setFillColor() Availability Fireworks 3.
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 edgemode Acceptable values are "hard edge", "antialias", and "feather". featherAmt An integer that specifies the number of pixels to feather. This value is ignored if edgemode is not "feather". Returns Nothing.
Returns Nothing. Description Sets the selection to the specified fill and fill color. dom.setFillNColorNTexture() Availability Fireworks 3. Usage dom.setFillNColorNTexture(fill, color, texture-name) Arguments fill color A Fill object (see “Fill object” on page 64). A color string (see “Color string data type” on page 11). texture-name The name of the texture to be applied. Returns Nothing. Description Sets the selection to the specified fill, fill color, and fill texture.
dom.setFillPlacement() Availability Fireworks 3. Usage dom.setFillPlacement(placement) Arguments placement Acceptable values are "top" and "bottom". Returns Nothing. Description Sets the fill placement for selected items with fills. dom.setFillVector() Availability Fireworks 3. Usage dom.setFillVector(p1, p2, p3) Arguments and p3 Points that specify the x,y coordinates of the three points used to calculate the fill vector (see “Point data type” on page 12). p1, p2, Returns Nothing.
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). p1 Returns Nothing. Description Modifies the fill vectors of the selection by moving the fill start to the specified point and then moving the two fill end handles to the same relative position. dom.setGradientName() Availability Fireworks 3. Usage dom.
dom.setGridOrigin() Availability Fireworks 3. Usage dom.setGridOrigin(gridOrigin) Arguments gridOrigin A point that specifies the x,y coordinates of the document’s grid origin (see “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 A point that specifies the x,y coordinates that are used for the document’s grid size (see “Point data type” on page 12).
dom.setGridColor() Availability Fireworks 3. Usage dom.setGridColor(gridColor) Arguments gridColor A color string (see “Color string data type” on page 11). Returns Nothing. Description Sets the color used to display the grid. dom.setGroupType() Availability Fireworks 3, arguments deprecated in Fireworks 4. Usage dom.setGroupType({type}) Arguments An optional string that specifies how to group the items. Acceptable values are is omitted, "normal" is assumed.
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, use dom.setSliceGuideColor(). See also dom.setSliceGuideColor() dom.setHotspotAltTag() Availability Fireworks 3. Usage dom.
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 whatToSet Acceptable values are "hotspots", "slices", and "hotspots and slices". A color string (see “Color string data type” on page 11). color Returns Nothing.
bMakeCopy A Boolean value; if it is true, the selection is copied and resized instead of 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. dom.setHotspotShape() Availability Fireworks 3. Usage dom.setHotspotShape(whatToSet, shape) Arguments whatToSet shape Acceptable values are "hotspots", "slices", or "hotspots and slices".
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.
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. Usage dom.
Arguments An integer value that specifies the layer to be locked or unlocked, starting with (although, to specify the current layer, pass –1 here). To lock or unlock all the layers on a frame, use the bAllLayers argument. layerIndex 0 frameIndex An integer value that specifies the frame that contains the layer that is to be locked or unlocked, starting with 0 (although, to specify the current frame, pass –1 here). If bLock is true, the layer is locked. If bLock is false, it is unlocked.
dom.setLayerSharing() Availability Fireworks 3. Usage dom.setLayerSharing(layerIndex, sharedStatus, bUnshareCopiesToAllFrames, bWarnUser) Arguments layerIndex An integer value that specifies the layer to be shared or not shared, starting with 0 (although, to specify the current layer, pass –1 here). sharedStatus Acceptable values are "shared" or "not shared". A Boolean value used only if sharedStatus is "not and the document has multiple frames.
Arguments An integer value that specifies the layer that should be shown or hidden, starting with 0 (although, to specify the current layer, pass –1 here). To show or hide all the layers on a frame, use the bAllLayers argument. layerIndex frameIndex An integer value that specifies the frame that contains the layer to be shown or hidden, starting with 0 (although, to specify the current frame, pass –1 here). A zero-based integer specifying the frame that contains the layer to be shown or hidden.
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” on page 11). If mask is null, any existing pixel-selection mask is removed.
Arguments before and after Integers that specify the number of frames to display before and after the current one. To disable onion skinning, pass 0 for both arguments. To enable onion skinning for all frames, pass 0 for before and a large number (for example, 99,999) for after. Returns Nothing. Description Sets the onion-skinning options for the document. Example The following command turns on onion skinning two frames before the selected frame and zero frames after it: fw.getDocumentDOM().
dom.setQuadrangle() Availability Fireworks 3. Usage dom.setQuadrangle(pTopLeft, pTopRight, pBottomRight, pBottomLeft, options) Arguments and pBottomLeft Relative coordinates of a quadrangle expressed as percentages of an arbitrary square. These are not specific x, y coordinates. pTopLeft, pTopRight, pBottomRight, options Acceptable values are "transformAttributes", "autoTrimImages", and "autoTrimImages transformAttributes". Returns Nothing.
Arguments roundness A floating-point value between 0 and 1 that specifies the roundness to use for the corners (0 is no roundness, 1 is 100% roundness). Returns Nothing. Description Modifies the corner roundness of all the selected rectangle primitives. See also dom.addNewRectanglePrimitive(), dom.setRectSides() dom.setRectSides() Availability Fireworks 4. Usage dom.
dom.setSelectionBounds() Availability Fireworks 3. Usage dom.setSelectionBounds(boundingRectangle, opts) Arguments boundingRectangle A rectangle that specifies the new location and size of the selection (see “Rectangle data type” on page 12). Acceptable values are "transformAttributes", "autoTrimImages", and "autoTrimImages transformAttributes". opts Returns Nothing. Description Moves and resizes the selection in a single operation. dom.setSelectionMask() Availability Fireworks 4. Usage dom.
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 If bShowEdges is true, the Show Edges option is turned on. If bShowEdges is false, the option is turned off. bShowEdges Returns Nothing. Description Specifies whether the Show Edges option is on or off. dom.setShowGammaPreview() Availability Fireworks 3. Usage dom.
dom.setShowGrid() Availability Fireworks 3. Usage dom.setShowGrid(bShow) Arguments bShow If bShow is true, the grid is visible. If bShow is false, it is not visible. Returns Nothing. Description Specifies whether the grid is visible. dom.setShowGuides() Availability Fireworks 3. Usage dom.setShowGuides(bShow) Arguments bShow If bShow is true, the normal guides are visible. If bShow is false, they are not visible. Returns Nothing. Description Specifies whether normal guides are visible. dom.
Arguments If bShow is true, the rulers are visible. If bShow is false, they are not visible. bShow Returns Nothing. Description Specifies whether rulers are visible. dom.setShowSliceGuides() Availability Fireworks 3. Usage dom.setShowSliceGuides(bShow) Arguments If bShow is true, the slice guides are visible. If bShow is false, they are not visible. bShow Returns Nothing. Description Specifies whether slice guides are visible. dom.setShowSliceOverlay() Availability Fireworks 3. Usage dom.
Description Specifies whether the slice overlay is visible. dom.setSliceAutonaming() Availability Fireworks 3. Usage dom.setSliceAutonaming(bAutoname) Arguments If bAutoname is true, automatic naming is turned on for the slice. If bAutoname is false, it is turned off. bAutoname 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. Usage dom.
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. dom.setSliceGuideColor() Availability Fireworks 3. Usage dom.
dom.setSliceHtml() Availability Fireworks 3. Usage dom.setSliceHtml(htmlText) Arguments htmlText A string that specifies the HTML text for the slice. Returns Nothing. Description If a single slice is selected, this function sets the slice’s HTML text. dom.setSliceIsHtml() Availability Fireworks 3. Usage dom.setSliceIsHtml(bHtml) Arguments bHtml If bHtml is true, sets the slices as HTML. If bHtml is false, sets the slices as Image. Returns Nothing.
Arguments If bSnap is true, the tools snap to the grid. If bSnap is false, they do not. bSnap Returns Nothing. Description Specifies whether tools snap to the grid. dom.setSnapToGuides() Availability Fireworks 3. Usage dom.setSnapToGuides(bSnap) Arguments If bSnap is true, the tools snap to all guides. If bSnap is false, they do not. bSnap Returns Nothing. Description Specifies whether tools snap to guides. dom.setSymbolProperties() Availability Fireworks 3. Usage dom.
newName Specifies the new name for the symbol. 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 are "left", "center", "right", "justify", alignment "stretch", "vertical left", "vertical center", "vertical right", "vertical justify", and "vertical stretch". Returns Nothing. Description Sets the alignment of the selected text items. dom.
Description Sets the anti-aliasing level for the selected blocks of text. NO TE To turn anti-aliasing on or off, call dom.enableTextAntiAliasing. See also dom.enableTextAntiAliasing() dom.setTextAutoKern() Availability Fireworks 3. Usage dom.setTextAutoKern(bKern) Arguments bKern false, If bKern is true, automatic kerning is on for the selected text items. If bKern is it is off. Returns Nothing. Description Specifies whether automatic kerning is on or off for the selected text items. dom.
Returns Nothing. Description Adjusts the kerning of text. dom.setTextCustomAntiAliasOverSample() Availability Fireworks MX 2004. Usage dom.setTextCustomAntiAliasOverSample(overSample) Arguments overSample The integer 4, 8 or 16 that specifies the amount of oversampling used to antialias text in custom mode. Returns Nothing. Description Sets the oversampling used to anti-alias text in custom mode. dom.setTextCustomAntiAliasSharpness() Availability Fireworks MX 2004. Usage dom.
dom.setTextCustomAntiAliasStrength() Availability Fireworks MX 2004. Usage dom.setTextCustomAntiAliasStrength(strength) Arguments Strength An integer value, from 0 to 255, for the amount of anti-aliasing to apply. Returns Nothing. Description Sets the strength value used to anti-alias text in custom mode. dom.setTextFlow() Availability Fireworks 3. Usage dom.setTextFlow(flowDirection) Arguments flowDirection Acceptable values are "left to right" and "right to left". Returns Nothing.
Arguments A floating-point number that describes how much to scale the text characters horizontally. A value of 1.0 is normal. Values greater than 1.0 make the characters wider, and values less than 1.0 make the characters narrower. horizScale Returns Nothing. Description Sets the horizontal scaling of text. For vertical text mode, this function stretches or compresses the height of the characters. dom.setTextLeading() Availability Fireworks MX. Usage dom.
dom.setTextOnPathMode() Availability Fireworks 3. Usage dom.setTextOnPathMode(mode) Arguments mode Acceptable values are "rotate", "vertical", "skew vertical", and "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 offset A floating-point value that specifies the offset distance, in pixels. Returns Nothing.
dom.setTextOrientation() Availability Fireworks 3. Usage dom.setTextOrientation(orientation) Arguments Acceptable values are "horizontal left to right", "vertical right to and "vertical left to right". orientation left", "horizontal right to left", Returns Nothing. Description Sets the horizontal/vertical text orientation of the selected text items. dom.setTextParaIndent() Availability Fireworks MX. Usage dom.
dom.setTextParaSpacingAfter() Availability Fireworks MX. Usage dom.setTextParaSpacingAfter(paraSpaceAfter) Arguments paraSpaceAfter The number of pixels to place after a paragraph before starting the 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. For vertical text mode, this function defines the vertical distance between paragraphs. dom.
dom.setTextRuns() Availability Fireworks 3. Usage dom.setTextRuns(textRuns) Arguments textRuns A TextRuns object (see “TextRuns object” on page 80). 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. Usage dom.setTransformMode(mode) Arguments mode Acceptable values are "paths" and "pixels". Returns Nothing.
dom.setTextRectangle() Availability Fireworks 3. Usage dom.setTextRectangle(boundingRectangle) Arguments boundingRectangle A rectangle that specifies the new size within which the text item should flow (see “Rectangle data type” on page 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; the text item is not scaled or transformed.
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 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.
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 None.
Returns Nothing. Description Swaps the current brush color and current fill color. This function has no effect on any selected items. dom.transformSelection() Availability Fireworks 3, updated in Fireworks 4. Usage dom.transformSelection(matrix, options) Arguments matrix A three-by-three transformation matrix (see “Matrix data type” on page 12).
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.
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, fw is synonymous with the Fireworks object. All methods of the Fireworks object can be referred to as fireworks.functionName() or as fw.functionName(). fw.
Arguments URL The URL of the page appear in the browser. Any legal URL (including http://, ftp://, and so on) can be passed. Fireworks does not check this argument for syntax; if you pass an illegal value, the browser does not open the URL. Returns Nothing. Description Opens the user’s primary browser and displays the specified URL. fw.browseForFileURL() Availability Fireworks 3. Usage fw.browseForFileURL(browseType, title, previewArea) Arguments Acceptable values are "open", "select", and "save".
Arguments title An optional string that specifies a title for the dialog box that appears. If it is omitted or null, a default title appears. startFolder An optional string that serves as the root directory for the dialog box that appears. If it is omitted or null, the browse dialog box displays an unspecified directory, depending on your system configuration. Generally, it is the last directory used. Description Displays a dialog box that lets a user select a particular directory. fw.
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 is true, Fireworks prompts the user to set the primary browser; if the argument is false, Fireworks prompts the user to set the secondary browser. primaryBrowser primaryBrowser Returns Nothing.
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. Usage fw.closeDocument(document, {bPromptToSaveChanges}) Arguments document A Document object that specifies the document to close (see “Document object” on page 14). An optional Boolean argument.
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(). See also fw.createFireworksDocument() fw.createDocumentWithDialog() Availability Fireworks MX 2004. Usage fw.createDocumentWithDialog() Arguments None.
Arguments A point whose x value specifies the document’s width and whose y value specifies the document’s height. Both values are in pixels. size res Specifies the resolution for the scaled document (see “Resolution data type” on page 12). backgroundColor A color string (see “Color string data type” on page 11). Returns The Document object for the newly created document (see “Document object” on page 14). Description Opens a new document and selects it.
Description Turns off debugging messages for Flash commands. For a description of the Flash debugging capabilities, see fw.enableFlashDebugging() on page 312. For more information about constructing Flash command panels for Fireworks, see “Flash panels” on page 115. NO T E The debugging commands work even if you are running a JavaScript file. fw.dismissBatchDialogWhenDone() Availability Fireworks 4. Usage fw.dismissBatchDialogWhenDone(autoClose) Arguments A Boolean value.
Returns Nothing. Description Turns on debugging messages for Flash commands. When Flash debugging is enabled, Fireworks displays the command string in a dialog box every time a Flash command calls MMExecute(). The fw.enableFlashDebugging() function is particularly useful for monitoring which commands are executed in a command panel. For information on how to turn off Flash debugging, see “fw.disableFlashDebugging()” on page 311.
fw.exportDirectorAsLayers() Availability Fireworks MX. Usage fw.exportDirectorAsLayers(document, fileURL) Arguments A Document object—for example fw.documents[2]—that specifies the document to export. If document is null, the active document is exported. document Specifies the filename for the exported file. If fileURL is null, Fireworks displays the Export dialog box. fileURL Returns A Boolean value: true if successful; false otherwise.
fw.exportDocumentAs() Availability Fireworks 3. Usage fw.exportDocumentAs(document, fileURL, exportOptions) Arguments A Document object, for example, fw.documents[2], that specifies the document to be exported. If document is null, the active document is exported. document A string, which is expressed as a file://URL, that specifies the filename for the exported file. If fileURL is null, the Save As dialog box is displayed. fileURL An ExportOptions object (see “ExportOptions object” on page 58).
Arguments A Document object that specifies the document that contains the frames to export (see “Document object” on page 14). To export frames from the current document, pass null. docObject directoryURL The directory where the images will be placed, which is expressed as a file:// URL. Returns A Boolean value: true if successful; false otherwise. Description Exports a document’s frames as individual images. The image names are based on the names in the Frames panel.
Returns A Boolean value: true if successful; false otherwise. Description Exports one image if the document contains no slice objects and multiple images if the document contains one or more slice objects. It also optionally exports HTML. The document is exported using the current export settings and export options. Example The following command exports the current document as HTML and as one or more images. fw.exportHtmlAndImages(null, "file:///C|/mysite/nav.htm", "file:///C|/ mysite/images/nav.
fw.exportLayers() Availability Fireworks 4. Usage fw.exportLayers(docObject, directoryURL) Arguments A Document object that specifies the document that contains the layers to export (see “Document object” on page 14). To export layers from the current document, pass null. docObject directoryURL The directory in which the images will be placed, which is expressed as a file://URL. Returns A Boolean value: true if successful; false otherwise.
Returns A Boolean value: true if successful; false otherwise. 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. var prevWarn = fw.getPref("PsdExport_Warn100"); // bool fw.setPref("PsdExport_Warn100", false); // don't warn. var kObjToLayer = 1; var kFlatten = 2; var prevLayers = fw.
Arguments A Document object that specifies the document to be exported (see “Document object” on page 14). To export the current document, pass null. docObject The name of the Macromedia Flash document to be created, which is expressed as a file://URL. FlashDocumentURL Returns A Boolean value: true if successful; false otherwise. Description Exports a Fireworks document as a Macromedia Flash document. Example The Macromedia Flash writer is controlled by the values of several preferences.
fw.findApp() Availability Fireworks MX. Usage fw.findApp(macAppSignature or winExeRegistryName) Arguments macAppSignature A Macintosh-specific string that identifies the signature of the application to find, such as "MKBY". A Windows-specific string that identifies the name of an executable to find in the Windows registry, such as "Fireworks.exe". winExeRegistryName Returns A URL to the application. This URL can be passed as an argument to fw.launchApp().
Returns The number of items that are replaced if the search is completed, or –1 if there are items in 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 fw.setUpFindReplace() fw.findOpenDocument() Availability Fireworks 3. Usage fw.
Arguments An optional string that is included for compatibility with Dreamweaver. If specified here, it must be "document". which-string Returns The Document object for the active document, or null if no document is open. Description Gets the Document object for the active document (see “Document object” on page 14). fw.getDocumentPath() Availability Fireworks 3. Usage fw.getDocumentPath(document) Arguments A Document object, for example, fw.
Returns An array like the one in the following example: [ [ "stroke", "fill", "effect" ], [ "layers", "frames", "object" ], [ "mixer", "options", "swatches", "info" ], [ "styles", "library" ], [ "find", "project log" ], [ "url" ], [ "optimize", "optimized colors" ], [ "behaviors" ], [ "history" ] ] NO TE Any panels not specified in the list of valid arguments (like those in the Command Panels folder which are “outside” the Fireworks application) should be named exactly as they appear in the file system wi
fw.getFloaterVisibility() Availability Fireworks 3. Usage fw.getFloaterVisibility(panelName) Arguments panelName Acceptable values are "find", "project log", "object", "info", "url", "effect", "history", "mixer", "fill", "stroke", "swatches", "layers", "frames", "behaviors", "optimize", "library", "styles", "optimized colors", "options", and "toolbox".
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 filename The name of the file that contains the tables to be counted. Returns A long integer that represents the number of tables in the document. Description Returns the number of top-level (that is, non-nested) tables in a document. fw.
Arguments prefkey A string that specifies the Preference value to return. A complete list of these values is beyond the scope of this documentation, but the format of prefkey exactly matches that in the Fireworks Preferences file. To set a Preference value, use fw.setPref(). Returns A string or numeric Preference value. Description Returns the Preference value (string or numeric) that is associated with the specified Preference key. See also fw.setPref() fw.launchApp() Availability Fireworks MX.
fw.launchBrowserTo() Availability Fireworks MX. Usage fw.launchBrowserTo(url) Arguments url 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. Usage fw.
The following table lists acceptable values for formatname and the file type each value represents.
If bOpenAsNew, which was added in Fireworks 4, is true, the files are opened as unsaved and untitled documents. If bOpenAsNew is false (the default value), they are opened with their original names. This argument is optional. bOpenAsNew bOpenWithWindowHidden Boolean. If bOpenWithWindowHidden, which was added in Fireworks 8, is true, and if there is only one document to open, the document will be hidden when opened. If more than one document is being opened, this parameter is ignored.
Returns The specified color in #rrggbbaa format (for syntax details, see “Color string data type” 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 #rrggbbaa format, which is the color initially selected in the dialog box. (For syntax details, see “Color string data type” on page 11.
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. Usage fw.
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 filepath The location of the panel state file as a string in the format file://URL. Returns Nothing. Description Reads in a panel state file, which is generated by “fw.
Description Verifies that the selection matches the current search string and replaces it with the replacement string. See also fw.setUpFindReplace() fw.replaceAll() Availability Fireworks 3. Usage fw.replaceAll() Arguments None. Returns The number of items replaced, or –1 if the search is not yet complete. Description Performs a replace all operation on the active document using the current search-and-replacement strings. See also fw.setUpFindReplace() fw.revertDocument() Availability Fireworks 3.
Returns Nothing. Description Restores the specified document to its previously saved version. fw.runScript() Availability Fireworks 3. Usage fw.runScript(filename) Arguments filename The name of the script file to execute. If filename is not a file URL (that is, if it does not begin with "file:///"), it is assumed to be the name of a file in the Fireworks MX/ Configuration/Commands folder. Returns Result of script. Description Executes a JavaScript file.
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, fw.documents[2], that specifies the document to be saved. If document is null, the active document is saved. document fileURL The name of the saved document, which is expressed as file://URL. This argument is optional.
Arguments A Document object, for example, fw.documents[2], that specifies the document to save. If document is null, the active document is saved. document Returns The file URL for the saved document, or null if the dialog box was canceled. 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. To save a document to another format, such as GIF or JPEG, use fw.exportDocumentAs(). See also fw.
fw.saveJsCommand() Availability Fireworks 3. Usage fw.saveJsCommand(jscode, filename) Arguments jscode The string of code to be saved as a JSF command file. The name under which the file should be saved. If filename is not a file URL (that is, if it does not begin with "file:///"), the file is saved in the Fireworks MX/ Configuration/Commands folder. filename Returns Nothing. Description Saves the specified string of JavaScript code as a JSF command file. fw.
fw.setActiveWindow() Availability Fireworks 3. Usage fw.setActiveWindow(document, {trueFalse}) Arguments A Document object, for example, fw.documents[2], that specifies which document should be made active. document This optional argument is ignored by Fireworks. It is included only for Dreamweaver compatibility. trueFalse Returns Nothing. Description Sets the specified document as the active document. Example The following command makes the fourth document the active document. fw.
A lowercase string that specifies the panel into which the panel should move. If panelNameToReceive is null, the panelNameToMove panel moves into its own panel. Acceptable values are "find", "project log", "object", "info", "url", "effect", "history", "mixer", "fill", "stroke", "swatches", "layers", "frames", "behaviors", "optimize", "library", "styles", "optimized colors", "options", and "toolbox".
Arguments panelName Acceptable values are "find", "project log", "object", "info", "url", "effect", "history", "mixer", "fill", "stroke", "swatches", "layers", "frames", "behaviors", "optimize", "library", "styles", "optimized colors", "options", and "toolbox". NO TE Any panels not specified in the list of valid arguments (like those in the Command Panels folder which are “outside” the Fireworks application) should be named exactly as they appear in the file system without their file extension.
bVisible If bVisible is true, the specified panel is visible. If bVisible is false, the panel is hidden. Returns Nothing. Description Shows or hides the specified panel. fw.setHideAllFloaters() Availability Fireworks 3. Usage fw.setHideAllFloaters(bHide) Arguments If bHide is true, the panels are hidden. If bHide is false, the panels are visible. bHide Returns Nothing. Description Shows or hides the panels. This behavior is the same as the Tab key behavior. fw.
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 findSpec A Find object (see “Find object” on page 23). Returns Nothing. Description Sets up a search. fw.toggleFloater() Availability Fireworks 3. Usage fw.
Arguments panelName Acceptable values are "find", "project log", "object", "info", "url", "effect", "history", "mixer", "fill", "stroke", "swatches", "layers", "frames", "behaviors", "optimize", "library", "styles", "optimized colors", "options", and "toolbox". NO TE Any panels not specified in the list of valid arguments (like those in the Command Panels folder which are “outside” the Fireworks application) should be named exactly as they appear in the file system without their file extension.
fw.updateHTML() Availability Fireworks 4. Usage fw.updateHTML(doc, htmlUrl, bRecoverFromError) Arguments doc A Document object that specifies the document to be used for updating the HTML (see “Document object” on page 14). If doc is null, the active document is used. The filename of the HTML file to update, which is expressed as a file://URL. To force Fireworks to display the Update HTML dialog box, pass null for htmlUrl. If you pass null for htmlUrl, bRecoverFromError is ignored.
Returns Nothing. Description Writes out the panel states (location, size, open or closed, and so on), toolbox state, and Property inspector state to an XML file that is specified by the argument. fw.yesNoDialog() Availability Fireworks MX. Usage fw.yesNoDialog(promptString) Arguments promptString The prompt message that appears in the dialog box. Returns A Boolean value: true if the user selected the Yes button; false otherwise.
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. Returns Nothing. Description Makes the Property inspector window invisible.
fw.isPIExpanded() Availability Fireworks MX. Usage fw.isPIExpanded() Arguments None. Returns A Boolean value: true if expanded; false otherwise. Description Determines whether the Property inspector window is currently expanded or minimized fw.isPIVisible() Availability Fireworks MX. Usage fw.isVisible() Arguments None. Returns A Boolean value: true if visible; false otherwise. Description Determines whether the Property inspector window is currently hidden or shown. fw.
Arguments None. Returns Nothing. Description Expands the Property inspector window. fw.shrinkPIWindow() Availability Fireworks MX. Usage fw.shrinkPIWindow() Arguments None. Returns Nothing. Description Minimizes the Property inspector window. fw.setPIPosition() Availability Fireworks MX. Usage fw.setPIPosition(pt) Arguments pt A point in screen coordinates. Returns Nothing.
Description Moves the upper-left corner of the Property inspector window to the specified location. fw.getPIPosition() Availability Fireworks MX. Usage fw.getPIPosition() Arguments None. Returns A point object that is formatted as {x: float, y: float} (see “Point data type” on page 12 for syntax details), which contains the location of the Property inspector. Description Retrieves the location, in screen coordinates, of the upper-left corner of the Property inspector window.
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 should be copied. If it is null, the currently selected steps are used. array of indexes Returns Nothing. Description Copies history steps to the Clipboard. fw.historyPalette.getSelection() Availability Fireworks 3. Usage fw.historyPalette.
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 should be returned as JavaScript.
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 fw.historyPalette.setUndoState(). This string is designed to be used internally by Fireworks only and might change format in the future. Do not try to parse this string or construct a custom string to pass to fw.historyPalette.
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 example, to save the first, third, and sixth steps in the History panel, pass [0, 2, 5]. If this argument is null, the currently selected steps are used.
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 undoStateString The string returned by 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.
Arguments name A string that specifies the name of the set of export settings to find. Returns If there is a set of export settings with the specified name, the argument returns an object that represents it; otherwise, it returns null. Description Looks for a set of export settings that were saved with the specified name. document.makeGoodNativeFilePath() Availability Fireworks 3. Usage document.
Using the common API You can use the common Macromedia API if you want commands to use a common syntax (and thus run a single command in multiple applications). You can access this API using app.methodName().The following methods are currently supported in Fireworks and Dreamweaver to let developers easily create commands for both applications. app.toggleFloater() Identical to fw.toggleFloater(). app.setFloaterVisibility() Identical to fw.setFloaterVisibility(). app.
Fireworks JavaScript API
Index A ActionScript 116 cross-product extensions 99 addBehavior() 132, 133 addElementMask() 138 addFrames() 138 addGuide() 139 addNewHotspot() 140 addNewImage() 140, 141, 142 addNewImageViaCopy() 141 addNewImageViaCut() 142 addNewLayer() 142 addNewLine() 143 addNewOval() 143 addNewRectangle() 144 addNewRectanglePrimitive() 145 addNewSinglePointPath() 146 addNewStar() 146 addNewSymbol() 147 addNewText() 148 addSwapImageBehaviorFromPoint() 149 AddToAutoReleasePool() 111 adjustExportToSize() 149 adjustFontSiz
clearSteps() 350 clipCopy() 159, 160 clipCopyAsPaths() 160 clipCopyFormats() 160 clipCut() 161 clipPaste() 161 clipPasteAsMask() 162 clipPasteAttributes() 163 clipPasteFromChannelToChannel() 164 clipPasteInside() 164 cloneSelection() 165 close() 166 closeDocument() 309 color string 11 colors, finding and replacing 24 Common Application API 357 confirm() 12 Contour object 36 ContourNode object 37 ContourNodeDynamicInfo object 39 Contrast properties (Effect object) 43 ControlPoint object 39 conventions, in bo
dom.applyCharacterMarkup() 153 dom.applyCurrentFill() 153 dom.applyEffects() 154 dom.applyFontMarkup() 155 dom.applyStyle() 155 dom.arrange() 156 dom.attachTextToPath() 156 dom.changeGuide() 157 dom.changeSliceGuide() 158 dom.clearJPEGMask() 159 dom.clipCopy() 159 dom.clipCopyAsPaths() 160 dom.clipCopyFormats() 160 dom.clipCut() 161 dom.clipPaste() 161 dom.clipPasteAsMask() 162 dom.clipPasteAttributes() 163 dom.clipPasteFromChannelToChannel() 164 dom.clipPasteInside() 164 dom.cloneSelection() 165 dom.
dom.moveSelectionBy() 214 dom.moveSelectionMaskBy() 214 dom.moveSelectionTo() 215 dom.moveSelectionToFrame() 216 dom.moveSelectionToLayer() 216 dom.moveSelectionToNewLayer() 217 dom.pathCrop() 217 dom.pathExpand() 218 dom.pathInset() 218 dom.pathIntersect() 219 dom.pathPunch() 219 dom.pathSimplify() 220 dom.pathUnion() 220 dom.previewInBrowser() 221 dom.rebuildColorTable() 221 dom.redo() 222 dom.redraw() 222 dom.reflectSelection() 223 dom.removeAllGuides() 224 dom.removeBehavior() 224 dom.
dom.setGridOrigin() 269 dom.setGridSize() 269 dom.setGroupType() 270 dom.setGuideColor() 271 dom.setHotspotAltTag() 271 dom.setHotspotColor() 272 dom.setHotspotRectangle() 272 dom.setHotspotShape() 273 dom.setHotspotTarget() 273 dom.setHotspotText() 274 dom.setLayerDisclosure() 275 dom.setLayerLocked() 275 dom.setLayerName() 276 dom.setLayerSharing() 277 dom.setLayerVisible() 277 dom.setMatteColor() 278 dom.setOnionSkinning() 279 dom.setOpacity() 280 dom.setPixelMask() 279 dom.setQuadrangle() 281 dom.
EffectList object 48 effectList property 94 effects, finding and replacing 24 EFileIsReadOnly 19 EFileNotFound 19 EGenericErrorOccurred 19 EGroupDepth 19 EIllegalThreadAccess 19 EInternalError 19 Element object 49 ElementMask object 56 elements, changing 10 elementsAt() 183 ELowOnMem 19 enableElementMask() 184 enableFlashDebugging() 312 enableTextAntiAliasing() 185 end-of-line character 13, 23 EndDragControlPoint 127 EndDragInsert 126 ENoActiveDocument 19 ENoActiveSelection 19 ENoFilesSelected 19 ENoNestedM
Flash wrapper extension 118 flattenDocument() 192 flattenSelection() 192 fonts, finding and replacing 24 Frame object 65 frameIndex argument 131 FrameNLayerIntersection object 66 func 102 fw and fireworks class names 305 fw.browseDocument() 305 fw.browseForFileURL() 306 fw.browseForFolderURL() 306 fw.browseHelp() 307 fw.checkFwJsVersion() 307 fw.chooseBrowser() 308 fw.chooseScriptTargetDialog() 308 fw.closeDocument() 309 fw.createDocument() 309 fw.createDocumentWithDialog() 310 fw.
G Gaussian Blur property (Effect object) 45 get 102 GetDefaultMoveParms() 76 getDocumentDOM() 322 getDocumentPath() 323 getFloaterGroupings() 323 getFloaterPosition() 324 getFloaterVisibility() 325 getFontMarkup() 193 getHideAllFloaters() 325 getHTMLFileForScript() 326 getNumberOfTables() 326 getPIPosition() 350 getPixelMask() 193 getPref() 326 getRootDirectory() 357 getSelection() 351 getSelectionBounds() 194 getShowGrid() 194 getShowRulers() 195 getSnapToGrid() 196 getStepCount() 352 getStepsAsJavaScript(
L N launchApp() 327 launchBrowserTo() 328 Layer object 67 layerIndex argument 131 Levels (Effect object) 46 linkElementMask() 205 loadColorPalette() 187 new features 6 null values 131 M makeActive() 207 makeFind() 206 makeGoodNativeFilePath() 356 mask 11 matrix 12 mergeDown() 207 Metafile.
Slices 91 Style 76 Text 55 TextAttrs 78 TextRuns 79 Texture 56 objects accessing within documents 32 classification 92 core objects 13 selected 92 openDocument() 329 optional arguments 10 P palette 132 panel 132 panels, custom 115 Path object 54 PathAttrs object 68 pathCrop() 217 pathExpand() 218 pathInset() 218 pathIntersect() 219 pathPunch() 219 pathSimplify() 220 pathUnion() 220 Pattern object 68 Photoshop document, exporting as 318 pngText 18 point 12 popupColorPicker() 330 popupColorPickerOverMouse()
RPCMethods.DestroyAutoReleasePool() 111 RPCMethods.ReleaseObject() 112 RPCMethods.
setLayerSharing() 277 setLayerVisible() 277 setMatteColor() 278 setOnionSkinning() 279 setOpacity() 280 setPIPosition() 349 setPixelMask() 279 setPref() 342 setQuadrangle() 281 setRectRoundness() 281 setRectSides() 282 setSelection() 354 setSelectionBounds() 283 setSelectionMask() 283 setShowEdges() 284 setShowGammaPreview() 284 setShowGrid() 285 setShowGuides() 285 setShowRulers() 285 setShowSliceGuides() 286 setShowSliceOverlay() 286 setSliceAutonaming() 287 setSliceExportOptions() 287 setSliceFilename()
V values 10 W Working with selected elements 132 write() 13 WRITE_HTML() 13 writePanelStateToFile() 345 X XML 100 Y yesNoDialog() 346 Z zero-based indexes 131 Index 371
Index