17
EXTENDING FIREWORKS
The Fireworks Object Model
Las
t
up
d
a
ted
12/8/2009
Method
Data type
Notes
copy
(docname1, docname2)
string, string
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.
createDirectory(dirname)
string
Creates the specified directory. Returns
true
if successful;
false
otherwise.
createFile(fileURL,
fileType, fileCreator)
string, string, string
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");
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
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.
enumFiles(docOrDir)
string
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).
exists(docOrDir)
string
Returns
true
if
docOrDir
refers to a directory or file that
exists;
false
otherwise.
getDirectory(docname)
string
Returns only the directory name from
docname
, which is
expressed as
file://URL
. For example,
Files.getDirectory("file://work/logo.png")
returns
"file:///work"
.
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"
.
getLanguageDirectory()
string
Returns the URL of the language directory associated with the
currently running language.
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
.