Using the Fireworks Object Model
11
For example, if the first open document is the current document, the first code fragment has
the same effect as the second and third code fragments. The
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].resolutionUnits ="inch";
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 more information, 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 compressed"
,
"rle 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.
Summary of Contents for FIREWORKS 8-EXTENDING FIREWORKS
Page 1: ...Extending Fireworks ...
Page 4: ...4 Contents ...
Page 358: ...358 Fireworks JavaScript API ...
Page 372: ...372 Index ...