MACROMEDIA FIREWORKS 8-EXTENDING FIREWORKS Spezifikationen Seite 19

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 35
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 18
207
EXTENDING FIREWORKS: DEVELOPING AN EFFECTIVE WORKFLOW USING JAVASCRIPT AND FLASH
+ " rect.left = left;\n"
+ " rect.top = top;\n"
+ " rect.right = left + width;\n"
+ " rect.bottom = top + height;\n"
+ " \n"
+ " fw.getDocumentDOM().addNewRectanglePrimitive(rect,
cornerRadius);\n"
+ " fw.getDocumentDOM().setFillColor(color);\n"
+ "}\n"
+ "";
The entire contents of the JSF source file specified in the FDT have been converted to a string, escaped
correctly, and assigned to the variable name specified, in this case jsfCode. You can now use the
#include method introduced earlier and reference this AS file. With the
AutoConvert option enabled,
you’ll be able to edit, save, and test your JSF, and then switch to Flash and recompile, without having
to manually import/update the JSF code in your Flash project.
Updating the Draw Rect panel
Now that you have an external AS file housing your JSF, you can remove the code- housing TextBlock
that you added earlier in the chapter. The only other thing you need to do is update the ActionScript
on your
Actions layer to reference the external file and execute the JSF variable:
#include "jsfCode.as"
executeJSF_btn.onRelease = function() {
// Execute the JSF, creating the CreateRectangle function
MMExecute(jsfCode);
// Calculate the CornerRadius value
var cornerRadius:Number = nsCornerRadius.value / 100;
// Call CreateRectangle
MMExecute("CreateRectangle(" + nsX.value + "," + nsY.value
+ "," + nsWidth.value + "," + nsHeight.value + ","
+ cornerRadius.toString() + ", '" + currentColor + "');");
}
With the exception of adding the #include statement, the only other change required in the
ActionScript is the MMExecute() statement—jsfCode_txt.text was replaced with jsfCode, the vari-
able name defined in the FDT. This now concludes the workflow section of the chapter. We’ve worked
our way from the ground up, starting with a simple JSF command and ultimately creating a fully func-
tional Flash panel.
Defining Flash panel resize behavior
When creating Fireworks panels, you must be aware that the user can resize the panel, just like any other
panel you encounter in Fireworks. When authoring panels in Flash (and not Flex), we have to manually
define the resize behavior. Flex provides layout panels that automatically react to stage resizing, so this
section can pretty much be ignored if you’re planning to exclusively author your panels in Flex.
Seitenansicht 18
1 2 ... 14 15 16 17 18 19 20 21 22 23 24 ... 34 35

Kommentare zu diesen Handbüchern

Keine Kommentare