|
5 600 brands
1 870 000 user's guides |
|
|
|||||||||||||||
|
Search a brand
Advanced Search
|
Our partners wish to propose you the following products
|
User manual MACROMEDIA FIREWORKS MX 2004 - EXTENDING FIREWORKS
Diplodocs help download the user guide MACROMEDIA FIREWORKS MX 2004 - EXTENDING FIREWORKS.
Preview of the first 3 pages of manual
You either have JavaScript turned off or an old version of Adobe Flash Player Get the latest Flash Player.
User guide MACROMEDIA FIREWORKS MX 2004 - EXTENDING FIREWORKS
Detailed instructions for use are in the User's Guide. Extending Fireworks
Trademarks Afterburner, AppletAce, Attain, Attain Enterprise Learning System, Attain Essentials, Attain Objects for Dreamweaver, Authorware, Authorware Attain, Authorware Interactive Studio, Authorware Star, Authorware Synergy, Backstage, Backstage Designer, Backstage Desktop Studio, Backstage Enterprise Studio, Backstage Internet Studio, Contribute, Design in Motion, Director, Director Multimedia Studio, Doc Around the Clock, Dreamweaver, Dreamweaver Attain, Drumbeat, Drumbeat 2000, Extreme 3D, Fireworks, Flash, Fontographer, FreeHand, FreeHand Graphics Studio, Generator, Generator Developer's Studio, Generator Dynamic Graphics Server, Knowledge Objects, Knowledge Stream, Knowledge Track, LikeMinds, Lingo, Live Effects, MacRecorder Logo and Design, Macromedia, Macromedia Contribute, Macromedia Coursebuilder for Dreamweaver, Macromedia M Logo & Design, Macromedia Flash, Macromedia Xres, Macromind, Macromind Action, MAGIC, Mediamaker, Multimedia is the Message, Object Authoring, Power Applets, Priority Access, Roundtrip HTML, Scriptlets, SoundEdit, ShockRave, Shockmachine, Shockwave, shockwave.com, Shockwave Remote, Shockwave Internet Studio, Showcase, Tools to Power Your Ideas, Universal Media, Virtuoso, Web Design 101, Whirlwind and Xtra are trademarks of Macromedia, Inc. and may be registered in the United States or in other jurisdictions including internationally. Other product names, logos, designs, titles, words or phrases mentioned within this publication may be trademarks, servicemarks, or tradenames of Macromedia, Inc. or other entities and may be registered in certain jurisdictions including internationally. This guide contains links to third-party Web sites that are not under the control of Macromedia, and Macromedia is not responsible for the content on any linked site. If you access a third-party Web site mentioned in this guide, then you do so at your own risk. Macromedia provides these links only as a convenience, and the inclusion of the link does not imply that Macromedia endorses or accepts any responsibility for the content on those third-party sites. Apple Disclaimer APPLE COMPUTER, INC. MAKES NO WARRANTIES, EITHER EXPRESS OR IMPLIED, REGARDING THE ENCLOSED COMPUTER SOFTWARE PACKAGE, ITS MERCHANTABILITY OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. THE EXCLUSION OF IMPLIED WARRANTIES IS NOT PERMITTED BY SOME STATES. THE ABOVE EXCLUSION MAY NOT APPLY TO YOU. THIS WARRANTY PROVIDES YOU WITH SPECIFIC LEGAL RIGHTS. THERE MAY BE OTHER RIGHTS THAT YOU MAY HAVE WHICH VARY FROM STATE TO STATE. Copyright © 2003 Macromedia, Inc. All rights reserved. This manual may not be copied, photocopied, reproduced, translated, or converted to any electronic or machine-readable form in whole or in part without prior written approval of Macromedia, Inc. Part Number ZFW70M300 Acknowledgments Project Management: Gary White Writing: David Jacowitz and Gary White Editing Management: Rosana Francescato Editors: Linda Adler, Rosana Francescato, Mary Kraemer, Noreen Maher, Antonio Padial, Lisa Stanziano, Anne Szabla Production Management: Patrice O'Neill Multimedia Development: Aaron Begley Production: Adam Barnett, John Francis, Jeff Harmon Special thanks to Hiroshi Miyazawa, Brian Edgin, Robbie San Juan, and Andy Finnell
First Edition: September 2003 Macromedia, Inc. 600 Townsend St. San Francisco, CA 94103
CONTENTS
CHAPTER 1: Extending Fireworks Overview.
............................. 5
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Installing an extension. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 What's new in Extending Fireworks MX 2004 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Conventions used in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Additional resources for extension writers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
CHAPTER 2: The Fireworks Object Model .
.............................. 9
Using the Fireworks Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Global methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Core objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 The Fireworks object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Objects within Fireworks documents. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 HTML export objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Working with selected objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
CHAPTER 3: Cross-Product Extensions.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Cross-product architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Flash panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
CHAPTER 4: Auto Shapes
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
How Auto Shapes work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Creating an Auto Shape. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
CHAPTER 5: Fireworks JavaScript API
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 103 104 241 275 278 283
Using Fireworks API functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Document functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fireworks functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Property inspector functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . History panel functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using the common API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
INDEX
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
3
4
Contents
CHAPTER 1 Extending Fireworks Overview
To extend Macromedia Fireworks MX 2004, you must write JavaScript code. You can use JavaScript to write your own objects and commands that affect Fireworks documents and the elements within them. To accomplish these tasks, you must be proficient in JavaScript and in Fireworks. This guide introduces the Fireworks Object Model, explains how to write cross-product extensions (extensions written in, or for, other Macromedia applications), and discusses the JavaScript Auto Shape construction. The final chapter is a reference to the Fireworks JavaScript application programming interface (API)--the custom JavaScript functions that are built into Fireworks.
Prerequisites
Because Fireworks extensions must be written in JavaScript, this guide assumes that readers are familiar with JavaScript syntax and with basic programming concepts such as functions, arguments, and data types. It also assumes that readers understand the concept of working with objects and properties. This guide does not attempt to teach programming in general or JavaScript in particular. Anyone who wants to extend Fireworks should have a good JavaScript reference to help with syntax questions (for example, is it substring() or subString()?). Useful JavaScript references include JavaScript Bible by Danny Goodman (IDG), JavaScript: The Definitive Guide by David Flanagan (O'Reilly), and Pure JavaScript by R. Allen Wyke, Jason D. Gilliam, and Charlton Ting (Sams). For a free JavaScript reference, see: http://devedge.netscape.com/library/manuals/2000/ javascript/1.5/reference.
5
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.com/software/downloads).
2 Log on to the Macromedia Exchange website (www.macromedia.com/exchange). 3 Click the Fireworks Exchange link. 4 From the available extensions, select one that you want to use. Click the Download link to
download the extension package.
5 Save the extension package in a directory on your machine. 6 In Fireworks, choose Commands > Manage Extensions to start the Extension Manager (or,
you can start Extension Manager, located in the Macromedia program group, independently from Fireworks). 7 In the Extension Manager, choose File > Install Extension, and choose the extension package you just saved. The Extension Manager automatically installs the extension into Fireworks. You cannot begin using some extensions until you restart Fireworks. If you are running Fireworks when you install the extension, you might be prompted to quit and restart the application. To view basic information on the extension after its installation, go to the Extension Manager (Commands > Manage Extensions) in Fireworks.
What's new in Extending Fireworks MX 2004
Fireworks MX 2004 includes the following new features and interfaces that you can use to develop extensions for the product:
· Cross-product JavaScript communication
Cross-product JavaScript communication allows any application to control Fireworks by sending JavaScript instructions directly to Fireworks encoded in XML through a local socket. Through this connection, Fireworks can do anything that is supported in the Fireworks API. Event handling for SWF panels Third-party command panels developed in Flash for Fireworks (SWF command panels) can listen and respond to events that happen inside Fireworks MX 2004. So, if you develop a SWF command panel that creates a specific object for the user (such a spiral pattern), you can also leverage the new Fireworks event handling so the user can inspect the object and adjust the object properties. Auto Shapes Along with the new Auto Shapes implementation, the Fireworks M X 2004 API lets you define an Auto Shape entirely in JavaScript. (For information about working with Auto Shapes in Fireworks, see Using Fireworks Help.)
·
·
6
Chapter 1: Extending Fireworks Overview
Conventions used in this guide
The following typographical conventions are used in this guide:
· · · ·
Code font indicates code fragments and API literals, including class names, method names, function names, type names, scripts, SQL statements, and HTML and XML tag and attribute names. Italic code font indicates replaceable items in code. The continuation symbol (¬) indicates that a long line of code has been broken across two or more lines to fit on the page. When copying the lines of code, eliminate the continuation symbol and type the code as one line. Curly braces ({ }) around a function argument indicate that the argument is optional.
The following naming conventions are used in this guide:
· You refers to the developer who is responsible for writing extensions. · The user refers to the person using Fireworks. · The visitor refers to the person who views the graphic that the user created. Additional resources for extension writers
To communicate with other developers who are writing extensions, you can visit the Fireworks Online Forums. The Fireworks Online Forums are available through www.macromedia.com/ support/fireworks/ts/documents/fwnewsgroup.htm.
Additional resources for extension writers
7
8
Chapter 1: Extending Fireworks Overview
CHAPTER 2 The Fireworks Object Model
If you want to extend the functionality of Macromedia Fireworks MX 2004 by writing or modifying a JavaScript extensibility file, you must become familiar with the objects that Fireworks makes available through JavaScript. The hierarchy of these objects makes up the Fireworks Object Model, containing the following major components:
· Five global methods that are available from any part of the application and need not be ·
declared as methods of a particular object. These methods are described in "Global methods" on page 12. Four core objects: Document, Errors, Files, and Find. These objects and their properties and methods are described in detail in "Core objects" on page 12. (The App object that was used in Fireworks 3 is supported for backward compatibility, but its use is deprecated in favor of the Fireworks object.) The Fireworks object, which is described in "The Fireworks object" on page 22. Numerous objects associated with Fireworks documents, such as ExportOptions, Guides, Path, Image, and Text. These objects and their properties are described in "Objects within Fireworks documents" on page 26. A set of objects that you can use to specify the format of HTML code when exporting from Fireworks. These are described in "HTML export objects" on page 64.
· · ·
Using the Fireworks Object Model
When scripting extensions for Fireworks, you write JavaScript commands that send calls to the Fireworks Object Model to determine or change the current settings for a Fireworks document. For example, the following command calls the Fireworks object (fw) to obtain the path to the Export Settings directory (appExportSettingsDir), which is expressed as a file://URL. In other words, fw references the Fireworks global object, of which appExportSettingsDir is a property (see "The Fireworks object" on page 22), so a JavaScript command can assign the resulting value to a variable, as follows:
var expSetDir = fw.appExportSettingsDir;
9
Accessing a Fireworks document All the functions listed in "Document functions" on page 104 are methods of the Document object, which represents a Fireworks document. To perform a function on a Document object, you must first get the Document Object Model (DOM) of the document. You then call the functions as methods of that DOM.
Note: You can use methods that operate on a document's DOM only on open documents.
· To use a DOM function with a document other than the active document, use the following
syntax; note that documentIndex is a zero-based index that specifies which document the command will affect.
fw.documents[documentIndex].functionName();
· To use a DOM function with the active document, use
fw.getDocumentDOM().functionName(),
see fw.getDocumentDOM().
Passing values For all properties that are not read-only, you can pass values to change elements of a document. For example, the following command sets the fifth brush in the third open document to a square shape:
fw.documents[2].brushes[4].shape = "square";
The preceding example includes the following properties:
· · ·
is a property of the Fireworks object and contains an array of Document objects. brushes is a property of the Document object and contains an array of Brush objects. shape is a property of the Brush object.
documents
Note: Throughout this manual, optional arguments are enclosed in {braces}.
Fireworks Object Model calls and API calls In some cases, you can use Fireworks Object Model calls or API calls to perform the same operations. In other cases, a certain function might be available in either the Fireworks Object Model or the API, but not in both. For example, if the first open document is the current document, the first code fragment has the same effect as the second and third code fragments. The fw.getDocumentDOM() function references the current document (see "Accessing a Fireworks document" on page 10).
fw.getDocumentDOM().setDocumentResolution({pixelsPerUnit:72, units:"inch"}); fw.documents[0].resolution =72; fw.documents[0].resolutionUnits ="inch";
10
Chapter 2: The Fireworks Object Model
Formatting nonstandard data types In addition to the standard data types that can be passed to functions as arguments, or used as properties, such as integer, string, and so on, Fireworks accepts other data types.
· Some functions accept values that are Fireworks objects. For an explanation of these objects,
see "The Fireworks Object Model" on page 9.
· Some functions accept a string in a specific format. Others accept value types that are not
Fireworks objects but are JavaScript object types that are specific to Fireworks. These types of arguments are described next, in alphabetical order. Color string data type Functions that accept colors as arguments use the HTML syntax "#rrggbb". You can specify a color with an alpha (transparency) component by passing a longer string of the form "#rrggbbaa". Mask data type The format for a mask is {maskBounds: rectangle, maskKind: string, maskEdgeMode: string, featherAmount: int, maskData: hex-string}.
· maskBounds specifies the bounding rectangle of the mask area. · Acceptable values for maskKind are "rectangle", "oval", "zlib
"rle compressed",
compressed",
· ·
or "uncompressed". If the value of maskKind is "rectangle" or "oval", the maskData string is ignored, and a mask of the right shape is constructed that fills maskBounds and that has the edge specified by maskEdgeMode and featherAmount. If the value of maskKind is "zlib compressed", "rle compressed", or "uncompressed", the maskData string is presumed to contain 8-bit mask data in hexadecimal format that precisely matches the maskBounds to define the mask.
Matrix data type The format for a matrix is {matrix: [float, float, float, float, float, float, float, float, float]}. This guide assumes that you know how to use these nine values to construct a three-by-three transformation matrix; discussion of the construction of transformation matrices is beyond the scope of this manual. Point data type The format for a point is {x: float, y: float}. For instance, dom.addNewLine(startPoint, endPoint) could look like the following example:
fw.getDocumentDOM().addNewLine({x:64.5, y:279.5}, {x:393.5, y:421.5});
Rectangle data type The format for a rectangle is {left: float, top: float, right: float, bottom: float}. For instance, dom.addNewOval(boundingRectangle) could look like the following example:
fw.getDocumentDOM().addNewOval({left:72, top:79, right:236, bottom:228});
Using the Fireworks Object Model
11
Resolution data type The format for resolution is {pixelsPerUnit: float, units: string}. Acceptable values for units are "inch" or "cm". For instance, dom.setDocumentResolution(resolution) could look like the following example:
fw.getDocumentDOM().setDocumentResolution({pixelsPerUnit:72, units:"inch"});
Global methods
The following table lists the global Fireworks methods, along with their argument data types and, where appropriate, acceptable values and notes.
Method
alert(message)
Data type string string
Notes Displays a string in a modal alert box, along with an OK button. Returns nothing. Displays a string in a modal alert box, along with OK and Cancel buttons. Returns true if OK is clicked, false if Cancel is clicked. 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. Same as WRITE_HTML; WRITE_HTML was created to let you differentiate HTML output calls from other JavaScript calls in your code. Available only when exporting. Converts each argument to a string and writes it to the HTML output file. To enter an end-of-line character, use "\n"; this is converted to the correct line ending for your platform. For more information, see "HTML export objects" on page 64.
confirm(message)
prompt(caption, text)
string, string
write(arg1, arg2, ..., argN)
string
WRITE_HTML(arg1, arg2, ..., argN)
string
Core objects
This section describes the four core objects that are always available: Document, Errors, Files, and Find.
Note: For information on how to format nonstandard data types, such as rectangle or point, see "Formatting nonstandard data types" on page 11.
12
Chapter 2: The Fireworks Object Model
Document object The following table lists the properties of the Document object, along with their data types, acceptable values and notes. Read-only properties are marked with a bullet (·). You can also use many API calls to work with documents. For more information, see "Document functions" on page 104.
Property
backgroundColor
Data type string
Notes A color string that specifies the document canvas color (see "Color string data type" on page 11). Sets a general URL for a document that uses a Hotspot. Everything that is not covered by the Hotspot has the background URL. Array of Brush objects that are available for use in the document (see "Brush object" on page 26).
backgroundURL
string
brushes ·
array
currentFrameNum currentLayerNum defaultAltText
zero-based index The index of the current frame. zero-based index The index of the current layer. string Default Alt text for the output images. It works for single and sliced images. Sliced images get the default, unless specific text is specified for a slice. Corresponds to the text that is specified in File > HTML Properties > ImageMap > AltImageDescription. The title of the document file, without any file extension. If the document has not been saved, this string is empty. Identical to exportOptions. Included for backward compatibility with Fireworks 2. ExportOptions object (see "ExportOptions object" on page 46). ExportSettings object (see "ExportSettings object" on page 49). The path to the file from which this document was opened, which is expressed as file:// URL, or null if created from scratch. The location to which this document was saved, which is expressed as file://URL, or null if never saved. Array of Fill objects that are available for use in the document (see "Fill object" on page 51). The number of frames in the current document.
docTitleWithoutExtension
string
exportFormatOptions
object object object string
exportOptions
exportSettings
filePathForRevert
filePathForSave
string
fills ·
array
frameCount
integer
Core objects
13
Property
frameLoopingCount
Data type integer
Notes 1 -- don't repeat 0 -- repeat forever > 0 -- repeat this number of times Array of Frame objects in the document (see "Frame object" on page 52). If set to true, the document should be previewed in opposite-platform gamma. If set to false, the document colors are unadjusted. Array of Gradient objects that are available for use in the document (see "Gradient object" on page 53). A color string that specifies the color of the grid display (see "Color string data type" on page 11). Used to set the origin of the grid. Corresponds to the point set when dragging the ruler origin from the upper left of the document when rulers are visible.
gridSize.x is the horizontal grid size; gridSize.y is the vertical grid size.
frames ·
array Boolean
gammaPreview
gradients ·
array
gridColor
string
gridOrigin
point
gridSize
point object integer
guides ·
Guides object (see "Guides object" on page 53). Total height of the document, in pixels. To find the bottom edge of the document, use document.
top + document.height.
height
isDirty
Boolean Boolean Boolean
Set to true if the document was modified since the last ti me it was saved. Set to true if the document is currently in paint-mode editing, false otherwise. Set to true if the document is a Symbol or Button document, false if it is an ordinary document. You might see this when looking through the list of open documents and one is a symbol-editing window. Set to true if the document is open in Fireworks; false otherwise. (Occasionally the JavaScript object that is associated with a document lingers after the document closes; this property lets you check for that eventuality.)
isPaintMode ·
isSymbolDocument ·
isValid
Boolean
14
Chapter 2: The Fireworks Object Model
Property
lastExportDirectory
Data type string
Notes The path to the last directory to which the file was exported, which is expressed as file:// URL, or null if the file was never exported. For instance, if the document was last exported to "file:///files/current/ logo.gif", it returns "file:///files/
current".
lastExportFile
string
The name that was used the last time the file was exported, or null if the file was never exported. For instance, if the document was last exported to "file:///files/current/ logo.gif", it returns "logo.gif". An array of Layer objects in the document (see "Layer object" on page 54). Coordinate of the left edge of the document, in pixels. To find the right edge of the document, use document.left +
document.width.
layers ·
left
array integer
mapType
string
Acceptable values are "client", "server", and "both". Corresponds to the image-map type selected in File > HTML Properties > ImageMap. A color string that corresponds to the matte color specified in the Optimize panel (see "Color string data type" on page 11). This string is used by the useMatteColor property. Number of frames after the current frame to show through onion skinning. Corresponds to the onion-skin controls in the left edge of the Frames panel. A value of 0 indicates no onion skinning; a very large value (such as 99,999) indicates onion skinning of all frames after the current frame. Similar to the onionSkinAfter property, but refers to the number of frames to show through onion skinning before the current frame. List of internal pattern names. PathAttrs object (see "PathAttrs object" on page 54). This object specifies default attributes that will be applied to all newly created objects. A structure that can be used to store various chunks of text in a well-known format. For more information, see "The pngText object" on page 16.
matteColor
string
onionSkinAfter
integer
onionSkinBefore
integer
patterns · pathAttributes
object object
pngText
object
Core objects
15
Property
resolution
Data type float string
Notes Document resolution, in pixels per unit (see resolutionUnits). The range is 1 to 5000. The units to be used with the resolution property. Acceptable values are "inch" and "cm". Array of Texture objects that are available for use in the document (see "Texture object" on page 44). Coordinate of the top edge of the document, in pixels. To find the bottom edge of the document, use
document.top + document.height.
resolutionUnits
textures ·
array
top
integer
useMatteColor
Boolean
If set to true, the matteColor property is used when exporting documents with transparent backgrounds. If set to false, the matteColor property is ignored in this situation, and the exported file is matted against the document's canvas color. The width of the document, in pixels. To find the right edge of the document, use
document.left + document.width.
width
integer
The pngText object Fireworks maintains the following fields for use with the pngText object:
Field name
CreationTime Software
Value The date and time the document was created. The software used to create the document. The current version of Fireworks always sets this value to "Macromedia Fireworks MX 2004."
You can edit these or add your own fields, and they will be preserved across file saves. The pngText object corresponds directly to the 'tEXt' chunk of the document's PNG structure. Errors object All Errors object properties are read-only strings that are used to simplify the localizing of scripts. They return localized error messages appropriate to the specific error. For example, the English version of Fireworks returns "Memory is full." for the EOutOfMem property.
16
Chapter 2: The Fireworks Object Model
Here is an alphabetical list of the properties of the Errors object:
EAppAlreadyRunning, EAppNotSerialized, EArrayIndexOutOfBounds, EBadFileContents, EBadJsVersion, EBadNesting, EBadParam, EBadParamType, EBadSelection, EBufferTooSmall, ECharConversionFailed, EDatabaseError, EDeletingLastMasterChild, EDiskFull, EDuplicateFileName, EFileIsReadOnly, EFileNotFound, EGenericErrorOccurred, EGroupDepth, EIllegalThreadAccess, EInternalError, ELowOnMem, ENoActiveDocument, ENoFilesSelected, ENoNestedMastersOrAliases, ENoNestedPasting, ENoSliceableElems, ENoSuchElement, ENotImplemented, ENotMyType, EOutOfMem, EResourceNotFound, ESharingViolation, EUnknownReaderFormat, EUserCanceled, EUserInterrupted, EWrongType
Files object The following table lists the methods of the Files object, along with their data types and, where appropriate, acceptable values and notes.
Method
close()
Data type none
Notes Closes the file referred to by this Files 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. Copies the file specified in the first argument to the file specified in the second argument. Each argument must be the name of a file, which is expressed as file://URL. Only files (not directories) can be copied. The files do not need to reside on the same drive, and the method does not overwrite a file if it already exists. Returns a value of true if the copy is successful; false otherwise. Creates the specified directory. Returns true if successful; false otherwise. Creates the specified file. The file must not already exist. The first argument is the name of the file, which is expressed as file://URL. The last two arguments let you specify the file type and file creator strings. The fileType and fileCreator strings should each be strings of exactly four characters in length, for example:
Files.createFile(newFile,".txt","FWMX");
copy(docname1, docname2)
string, string
createDirectory(dirname)
string string, string, string
createFile(fileURL, fileType, fileCreator)
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().
Core objects
17
Method
Data type
Notes Deletes the specified file or directory. Returns true if successful; false if the file or directory cannot be deleted. Unlike deleteFile(), this method returns true if the file or directory does not exist. Returns an array of file URLs. If docOrDir is a directory, the array contains an entry for every file or directory that is contained in the specified directory. If docOrDir is a file, the array contains a single entry (the file passed in). Returns true if docOrDir refers to a directory or file that exists; false otherwise. Returns only the directory name from
docname, which is expressed as file://URL. For example, Files.getDirectory("file:// work/logo.png") returns "file:///work".
deleteFileIfExisting (docOrDir) string
enumFiles(docOrDir)
string
exists(docOrDir)
string string
getDirectory(docname)
getExtension(docname)
string
Returns the filename extension, if any, of docname. For example,
Files.getExtension("birthday.png")
returns ".png". If the filename has no extension, an empty string is returned. A filename that is expressed as file://URL is acceptable.
getFilename(docname)
string
Returns just the filename from docname, which is expressed as file://URL. For example, Files.getFilename("file:/// work/logo.png") returns "logo.png". 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. The argument, if used, must be expressed as file://URL. Returns a file URL in the Temporary Files directory or in the specified directory. This method does not create a file; it simply returns a unique file URL that does not conflict with existing files in the directory. If dirname is passed and is not null, the URL that is returned indicates a file in the specified directory rather than in the Temporary Files directory. The argument must be expressed as file:// URL. Returns true if the specified URL refers to a directory that exists; false otherwise.
getLastErrorString()
none
getTempFilePath ({dirname})
string
isDirectory(dirname)
string
18
Chapter 2: The Fireworks Object Model
Method
Data type
Notes The first argument must be expressed as file:/ /URL. Concatenates the two arguments to return a file URL that references the specified filename in the specified directory. For example,
Files.makePathFromDirAndFile("file:/// work/reports", "logo.png") returns "file:/ //work/reports/logo.png".
makePathFromDirAndFile(dirname, string, string plainFilename)
open(docname, bWrite)
string, Boolean
The first argument must be expressed as file:/ /URL. Opens the specified file for reading or writing. If the second argument is true, the file opens for writing; otherwise it opens for reading. If the file cannot be opened, returns null; otherwise, returns a Files object. Reads the next line from the file that is referred to by the current Files object and returns it as a string. The end-of-line character(s) are not included in the string. Returns null if end-of-file is reached or if the line is more than 2048 characters. 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. The first argument must be expressed as file:/ /URL. Returns a file URL with docname replaced by newPlainFilename. For example,
Files.setFilename("file:///work/ logo.png", "oldlogo.png") returns "file:// /work/oldlogo.png". This method does not
readline()
none
rename(docname, newPlainFilename)
string, string
setFilename(docname, newPlainFilename)
string, string
affect the file on disk; it simply provides a convenient way to manipulate file URLs. To change the name on disk, use rename().
swap(docname1, docname2)
string, string
Each argument must be expressed as a file:// URL. Swaps the contents of the two specified files, so that each file contains the contents of the other file. Only files (not directories) can be swapped, and both files must reside on the same drive. Returns true if the swap is successful; false otherwise. Writes the specified string to the file that is referred to by the current Files object. No end-of-line characters are appended; to include one, use "\n".
write(textString)
string
Core objects
19
Find object There are several ways to specify a Find object, depending on what you want to find and replace. Use the whatToFind property to specify the type of find operation, along with the properties that are associated with each legal value for whatToFind. These properties are listed in the following tables. Read-only properties are marked with a bullet (·). Finding and replacing text
Property
whatToFind find matchCase
Data type string string Boolean Boolean
Notes In the format: "text" Text to find. If set to true, the search is case-sensitive. Defaults to false. If set to true, the find and replace text is interpreted as a regular expression. The default is false. Text to use as replacement text. If set to true, only whole words matching the search text are found. The default is false.
regExp
replace wholeWord
string Boolean
Finding and replacing fonts and styles
Property
whatToFind find replace findStyle
Data type string string string integer
Notes In the format: "font" Name of font to find. Name of font to use as replacement. Number that represents the style to find:
AnyStyle = -1 Plain = 0 Bold = 1 Italic = 2 BoldItalic = 3 Underline = 4 BoldUnderline = 5 ItalicUnderline = 6 BoldItalicUnderline = 7
replaceStyle
integer integer integer integer
Number that represents the style to be used as replacement. 0 to 9999 0 to 9999 0 to 9999, or pass -1 to leave size as is
findMinSize findMaxSize replaceSize
20
Chapter 2: The Fireworks Object Model
If this document matches the user guide, instructions manual or user manual, feature sets, schematics you are looking for, download it now. Diplodocs provides you a fast and easy access to the user manual MACROMEDIA FIREWORKS MX 2004 - EXTENDING FIREWORKS. MACROMEDIA offer a product for which we do not have the user manual? Let us know what you are looking for: user guide, owner's manual, online manual, operating instructions, quick start guide, mounting instructions, schematics, service manual, installation instructions, RTFM. Diplodocs allows you to download user manual MACROMEDIA FIREWORKS MX 2004 - EXTENDING FIREWORKS, user guide MACROMEDIA FIREWORKS MX 2004 - EXTENDING FIREWORKS, instructions MACROMEDIA FIREWORKS MX 2004 - EXTENDING FIREWORKS, owner's manual MACROMEDIA FIREWORKS MX 2004 - EXTENDING FIREWORKS, online manual MACROMEDIA FIREWORKS MX 2004 - EXTENDING FIREWORKS.MACROMEDIA FIREWORKS MX 2004 - EXTENDING FIREWORKS, , Software. |
![]() |
Include the add-on to download manuals from your site, forum or blog | ![]() |
Frequently Asked Questions | ![]() |
Contact Diplodocs team | ![]() |
Last searches Last additions |
![]() |
Sitemap | ![]() |
|||
| Brands starting with A B C D E F G H I J K L M N O P Q R S T U V W X Y Z # | |||||||||||||
|
|
Copyright © 2005 - 2008 - Diplodocs -
All Rights Reserved. Designated trademarks and brands are the property of their respective owners. |