User Guide

118 Cross-Product Extensions
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. Instead of having to embed every Fireworks
function in
MMExecute(), you can use a series of fwapi functions in the ActionScript. Then,
when it is published, the wrapper translates the
fwapi functions into the expanded Fireworks
functions. You can also mix the
fwapi functions with MMExecute() statements.
To install the API wrapper, make sure you have the Macromedia Extension Manager installed
and double-click the Extension file. In Macromedia Flash, the wrapper appears in the
Components window as FWCommandComponents.
The following example shows a command without the wrapper:
var path = MMExecute("fw.appPatternsDir;");
The following example shows the same command using the wrapper:
var path =fwapi.getAppPatternsDir();
Working with ActionScript files
You can simplify the editing task by keeping a separate ActionScript file for ActionScript; in
this way, you dont need to open and edit the FLA file directly. Your FLA file must have a
#include myStringFile.as statement in the first frame (where myStringFile is the name
of your ActionScript file) to ensure that the ActionScript strings are complied at publishing
time.
NOTE
The FLA and ActionScript files should reside in the same folder so that the ActionScript
file can be easily found for compiling.