These functions correspond directly with the messages listed in
To invoke your own function names in response to Fireworks messages, you need to write a
statement.
switch()
Switch Statements
If you take a look at some existing Auto Shapes (in the Configuration/Auto Shapes folder and in
the Configuration/Auto Shape Tools folders), you'll notice a
beginning of the file. The Auto Shape JavaScript code in these files uses a
the initial message handler in the file. The
Fireworks so each message (that is useful to the particular Auto Shape) invokes a corresponding
function.
You can see this
Shape object may not need to process every message Fireworks sends, so only the useful messages
are written into the JavaScript file using the
case of a certain message, or messages, perform the following function.
In the Frame Auto Shape, this code is used to call
a
"SmartShapeEdited"
switch(smartShape.operation) {
case "BeginDragInsert":
case "InsertSmartShapeAt":
InsertSmartShapeAt(true);
break;
case "BeginDragControlPoint":
BeginDragControlPoint();
break;
case "DragControlPoint":
DragControlPoint();
break;
case "EndDragControlPoint":
EndDragControlPoint();
break;
case "SmartShapeEdited":
PlaceControlPoints();
break;
}
You don't need a response for every message Fireworks sends; but you do need to make sure the
statement handles the responses required by your shape.
switch
You can also invoke a single function for several messages:
case "BeginDragInsert":
case "InsertSmartShapeAt":
InsertSmartShapeAt(true);
break;
100
Chapter 4: Auto Shapes
statement in each of the Auto Shape JavaScript files. Again, a single Auto
switch
message:
"Fireworks messages" on page
switch()
statement sorts the messages sent by
switch()
qualifier. Effectively, the JavaScript file states in
case
PlaceControlPoints()
statement near the
statement as
switch()
when Fireworks sends
98.
Need help?
Do you have a question about the FIREWORKS MX 2004-EXTENDING FIREWORKS and is the answer not in the manual?
Questions and answers