MACROMEDIA FIREWORKS 8-EXTENDING FIREWORKS Spezifikationen Seite 6

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 35
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 5
194
CHAPTER 11
Command Panels folder: all users
Windows XP: C:\Program Files\Adobe\Fireworks CS4\Configuration\Command Panels
Windows Vista: C:\Program Files\Adobe\Fireworks CS4\Configuration\Command Panels
Mac OS X: HD:Applications:Adobe Fireworks CS4:Configuration:Command Panels
Editing and understanding the JSF
Now that you know where commands are stored, browse to the file that you just created, Draw
Rect.jsf, and open it using your text editor of choice. At this stage in the process, the lightweight
Notepad++ is a great choice that provides syntax highlighting. (Just select
Language JavaScript so
that Notepad++ interprets the JSF file as JavaScript.) If you followed our example earlier and saved the
same history steps we did, you should see code similar to the following:
line 1: fw.getDocumentDOM().addNewRectanglePrimitive
({left:36, top:39, right:101, bottom:104}, 0);
line 2: fw.getDocumentDOM().setFillColor("#99cc33");
Let’s break this down so you understand what’s happening. The two history steps you saved have been
translated into two lines of JavaScript, each representing a specific history item. Notice that both of
these lines begin with fw.getDocumentDOM(). This method call gets a reference to the DOM of the
active Fireworks document. All of the methods that we call to operate on objects on the canvas are
housed on the document’s DOM.
You can also access specific documents directly using the fw.documents object:
fw.documents[documentIndex] returns the DOM for the specified document.
So, following the requisite call to access the current document’s DOM is the actual method call.
On line 1, the addNewRectanglePrimitive method is called. This method accepts two arguments:
a boundingRectangle argument (of type Rectangle) and a roundness argument (of type double,
where 0 equals no roundness and 1 equals 100% roundness). The Rectangle type includes four prop-
erties: left, top, right, and bottom, each of type float. The syntax used as the first argument for
addNewRectanglePrimitive({left: 35, top: 39, right: 101, bottom: 104}) is a common way to
define an object in JavaScript (and other languages).
If you’re wondering how we know what parameters these methods are expecting, we’ll
cover this later in the section “Navigating the Extending Fireworks documentation.”
We could also have explicitly declared an object, and then set left, top, right, and bottom properties:
var myRect = new Object();
myRect.left = 36;
myRect.top = 39;
myRect.right = 101;
myRect.bottom = 104;
Seitenansicht 5
1 2 3 4 5 6 7 8 9 10 11 ... 34 35

Kommentare zu diesen Handbüchern

Keine Kommentare