![MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Manual Download Page 97](http://html1.mh-extra.com/html/macromedia/dreamweaver-mx-2004-extending-dreamweaver/dreamweaver-mx-2004-extending-dreamweaver_manual_3335562097.webp)
Creating an Auto Shape
97
// Set the new point's values
node.x = node.predX = node.succX = x;
node.y = node.predY = node.succY = y;
}
You can then simplify the
InsertSmartShapeAt()
function with the new helper function:
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.+;
// 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.
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...