92
Chapter 3: Cross-Product Extensions
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 (AS) files
You can simplify the editing task by keeping a separate AS file for ActionScript; in this way, you
don’t 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 AS file)
to ensure that the ActionScript strings are complied at publishing time.
Note:
The FLA and AS files should reside in the same folder so that the AS file can be easily found
for compiling.
Guidelines for creating panels and commands
•
You need to surround nested quotation marks need with backslash (\). The following example
prints:
John’s example is really “complex”!
MMExecute('alert("John\'s example is really \"complex\"!")';
•
The movie size set in Flash is used in Fireworks as the minimum and default size of the
command panel.
•
To improve the appearance and positioning of a modeless panel, turn off scaling and align the
panel contents with the upper left corner of the stage. You can make these changes with the
following ActionScript code:
Stage.align = "TC";
Stage.scaleMode = "noScale";
Events
Fireworks events for Flash panels allow developers to write event handlers for specific user
interaction. For example, a panel for creating a customized shape can respond to the user
changing the stroke attribute, and make changes to the lines in the shape accordingly.
How event handlers work
When a panel is launched and the Flash movie starts, Fireworks will scan the movie script for the
presence of event handlers. If a handler is present, Fireworks automatically registers the function
to receive the corresponding event. Fireworks only looks at the SWF file to see if it needs any of
these events when the panel opens (when the SWF file runs).
Summary of Contents for DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER
Page 1: ...Extending Fireworks...
Page 4: ...4 Contents...
Page 8: ...8 Chapter 1 Extending Fireworks Overview...
Page 102: ...102 Chapter 4 Auto Shapes...