|
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Fireworks Programmer's Guide to Fireworks Commands
Getting started with your first command
By: Dustin DuPree
Jan. 28, 2006 03:45 PM
As with almost any program you work with, there are going to be things you wish you could change, add, improve, or remove. It might be a feature you are used to from another program, or one you have devised on your own. "If only I could run to the developers and tell them my great idea, the program would be perfect," you say. I've often wanted to change things in my favorite software but am usually stuck waiting and hoping it will be fixed in the next version.
This article is intended for someone with an interest in making commands for Fireworks. It is a guide to help anyone who has even a small amount of programming knowledge to learn the procedure for creating commands. The first part of the article explains what commands are, where they are stored, and the different ways you can execute them. It also explains some of the basic concepts and structures of most Fireworks commands. The middle part examines a practical command example and discusses where to look for more help. The last section provides some advice for troubleshooting your commands as well as some information about packaging and distributing them. After completing this article you should have a good idea of what is possible with Fireworks commands and have an understanding of how to create and package them.
Getting Started with Your First Command Now that you have a basic understanding of what commands are and how they work, it's time to get started making some of your own. Hello World The first command you make will simply create a dialog box in Fireworks that says "Hello World!" If you are familiar with JavaScript, then the alert() function is nothing new to you, but you will still learn where to store your custom commands and how to run them. First open Fireworks and create a new document, approximately 500 pixels wide and 400 pixels tall. Create a new text file in your text editor of choice. Place this Fireworks command in it: alert("Hello World!"); That's it! Now save the command and you're done.
Saving Your Commands (Windows) C:\Program Files\Macromedia\Fireworks 8\Configuration\Commands (Mac OS) Macintosh HD:Applications:Macromedia:Fireworks 8:Configuration:Commands If you want to limit access to just to your user name, save it here:
(Windows) C:\Documents and Settings\ (Mac OS) Macintosh HD:Users:<User>: Library:Application Support:Macromedia:Fireworks 8:Commands Save the file as Hello World.jsf.
Testing Your Commands There are a couple of other options available for running commands in Fireworks:
Hello World wasn't all that much fun but at least now you know how to create, save, and run a command. This time let's utilize some more interesting functions in the Fireworks API to make a simple command that contains more Fireworks-specific code. Hello Universe Make a new document in your text editor and save it to the commands folder as "Hello Universe.jsf". Copy the following command code:
var dom = fw.getDocumentDOM(); The first line of code uses the getDocumentDOM() method of the fw object. You can think of the fw object as a code representation of the Fireworks application itself. It contains the functionality and methods for the common tasks that Fireworks performs, such as Save Document, Save As, Export, and even Quit. The getDocumentDOM() method returns the Document Object Model (DOM) for the active document. The document's DOM is stored into the dom variable to be used later in the command. The document's DOM can be thought of as a code representation of the active document in Fireworks. Any action you would perform on a document in Fireworks is handled by methods of the document's DOM, such as creating a rectangle, adding a text object, and arranging layers. Reader Feedback: Page 1 of 1
Your Feedback
Latest Cloud Developer Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week
Breaking Cloud Computing News
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||