![MACROMEDIA FIREWORKS 8-EXTENDING FIREWORKS Manual Download Page 114](http://html1.mh-extra.com/html/macromedia/fireworks-8-extending-fireworks/fireworks-8-extending-fireworks_manual_3339145114.webp)
114
Cross-Product Extensions
3.
In the first frame, add the following in the Actions panel to link the general fireworks stub
file to the movie when it is published:
#include "fwstubs.as"
4.
Create a simple button which will activate the RPC script.
5.
Insert the button in the first frame, in the middle of the Stage.
6.
Attach the following ActionScript code to the button to activate the RPC code when the
button is clicked:
on(press){
RPCMethods.CreateAutoReleasePool();
var fw = new Fireworks();
//Hide all panels - this function commented out as it will crash if run
from inside Fireworks
//fw.setHideAllFloaters(true);
//Define the document objects the long way
var res = new Object();
res.units = "inch";
res.pixelsPerUnit = 72;
var size = new Object();
size.x = 220;
size.y = 220;
//Create new doc
var fwdoc = fw.createFireworksDocument(size, res, "#0033FF");
//Define a rectangle object the short way
var rect = {left:10, top:10, right:210, bottom:210};
//Add Rectangle
fwdoc.addNewRectanglePrimitive(rect,0.20);
//Set its color
fwdoc.setFillColor("#00CC99");
RPCMethods.DestroyAutoReleasePool();
}
RPCMethods.DestroyAutoReleasePool();
7.
Publish the SWF file.
When you publish the SWF file, make sure the stubs files are in the same directory as your
FLA file.
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 ...