Creating an Auto Shape
99
The following table lists all of the available Fireworks message handler functions you can create
(although, you don’t have to write a response to every Fireworks message, only the ones important
to your Auto Shape):
Function
Description
InsertSmartShapeAt()
Draws the initial shape. This function is called 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. Define all initial properties of
the Auto Shape in this function.
BeginDragInsert()
Tells Fireworks what to do when the user drags an Auto Shape on the
canvas. You can define movements for control points and nodes that you
defined in
InsertSmartShapeAt()
.
DragInsert()
This function is called every time the mouse moves during a drag
operation (as long as
smartshape.getsDragEvents
is set to
true
). See
“SmartShape object” on page 60
.
EndDragInsert()
This function is called on a mouse-up event after a drag operation.
BeginDragControlPoint()
Tells Fireworks what to do when the user clicks and holds the mouse
button on a control point. Fireworks can change the object as the user
moves the mouse (for example, using the RegisterMove method of the
SmartShape object, see
“ContourNode object” on page 29
for more
information about how to get the properties of a smartShape object), or
wait until after a mouse event to change the object.
The following example uses the RegisterMove method to set the
properties for the object on the mouse-down event so that the user can
preview changes during the drag operation:
function BeginDragControlPoint()
{
switch (smartShape.currentControlPointIndex) {
case 0:
var parms = smartShape.GetDefaultMoveParms();
smartShape.elem.controlPoints[0].RegisterMove(parms);
smartShape.elem.elements[0].contours[0].nodes[0].RegisterMove(pa
rms);
break;
}
}
DragControlPoint()
This function is called every time the mouse moves during a drag
operation. Fireworks can change the object as the user moves the
mouse or wait until the mouse event ends to change the object.
If the
BeginDragControlPoint()
function specifies control points or other
points, Fireworks will not call the
DragControlPoint()
function .
EndDragControlPoint()
Tells Fireworks how to draw the final Auto Shape, after a drag operation
is complete. If Fireworks handled shape changes through the
BeginDragControlPoint()
function, then you can use the end result of
that function as a starting point. In that case, the code need not reflect
every change in shape, but just the changes that aren’t handled by
BeginDragControlPoint()
.
SmartShapeEdited()
This function is called when any changes have been made to the Auto
Shape that might change the shape’s behavior (such as removing a node
inside an Auto Shape object).
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...