Adobe 65011817 - Fireworks CS4 - Mac Extended User Manual page 304

Extending guide
Hide thumbs Also See for 65011817 - Fireworks CS4 - Mac:
Table of Contents

Advertisement

Last updated 12/8/2009
You can then simplify the
function InsertSmartShapeAt()
{
var elem = smartShape.elem;
var newPath = new Path;
elem.elements[0] = newPath;
newPath.contours[0] = new Contour;
var contour = newPath.contours[0];
var i = 0;
addPathPoint(contour, i++, 0, 0);
addPathPoint(contour, i++, 200, 0);
addPathPoint(contour, i++, 200, 125);
addPathPoint(contour, i++, 0, 125);
contour.isClosed = true;
}
Adding control points
After selecting an Auto Shape in a document, the user can click its control points to adjust the object. You must define the
control points for your Auto Shape before you can define what happens to the object when the user manipulates them.
The following code adds a single control point to the coordinates (0, 0):
smartShape.elem.controlPoints.length++;
// Establish the new control point
var cp=smartShape.elem.controlPoints[smartShape.elem.controlPoints.length-1];
// Place the Control Point
cp.x = 0;
cp.y = 0;
Handling the user interaction
After you define the Auto Shape properties and control points, you need to tell Fireworks how to handle user
interactions with the Auto Shape. To facilitate the interaction of the user with the Auto Shape, Fireworks sends a series
of messages to the Auto Shape object as the user performs certain operations on the Auto Shape. You can write a series
of functions to respond to these messages.
Fireworks messages
Fireworks passes the following messages to the SmartShape object as the user interacts with (inserts, moves, or
changes) the shape:
• "
InsertSmartShapeAt
Fireworks sends this message when the user selects the shape from the Tools panel and clicks on the canvas, or drags
the shape from the Auto Shapes panel to the canvas.
"BeginDragInsert"
Fireworks sends this message when the user drags an Auto Shape onto the canvas. This message defines a more
specific action than the "InsertSmartShapeAt" message.
"DragInsert"
InsertSmartShapeAt()
"
function with the new helper function:
300
EXTENDING FIREWORKS
Auto Shapes

Advertisement

Table of Contents
loading

This manual is also suitable for:

Fireworks cs4

Table of Contents