User Guide
131
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. The following rules apply to all functions.
Zero-based indexes
Some functions take an index argument which is a zero-based, one-dimensional array. That
means a value of
0 represents the first item in the array, 1 represents the second item, and so
on. For example, the following command deletes the second layer of the active Fireworks
document:
fw.getDocumentDOM().deleteLayer2;
Functions that take a frameIndex argument can be passed –1 to indicate the current
frame. Similarly, functions that take a
layerIndex argument may be passed –1 to indicate the
current layer.
Passing null values
In general, passing a null value to a function causes an exception to be thrown. A few
functions do allow
null as an argument; such cases are noted in the function descriptions.