126
Auto Shapes
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.+;
// 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"
Fireworks sends this message every time the mouse moves during a drag operation (as long
as smartshape.getsDragEvents is set to
true
). For more information, see
“SmartShape
object” on page 75
.
■
"EndDragInsert"
Fireworks sends this message on a
mouseUp
event after a drag operation.
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 ...