This example creates a 200 x 200 pixel rectangle in Fireworks when a button in a Flash application is clicked.
#include "fwstubs.as"
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();
When you publish the SWF file, make sure the stubs files are in the same directory as your FLA file.
The SWF creates a new Fireworks document, and draws a 200 x 200 pixel green rectangle in Fireworks:
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/fireworks/8/fwextending/fw_03_19.htm