Why would we want to mix extension types? There are all sorts of reasons, but they break down into considerations of interface usability versus extension functionality. Rollovers, Jump Menus, and Navigation Bars, Oh My!Sometimes the "correct" way to code an extension isn't the most logical one for the user. For instance, users intuitively expect items that insert things into documents to be part of the Insert bar and Insert menuInsert > Table, Insert > Image, Insert > Flash, and so forth. But not all insertion tasks are as easy as that. When a user chooses the Insert Rollover object, for instance, what's happening? Dreamweaver is inserting the code for a linked image into the document at the insertion point, but the program is also inserting a Swap Image function in the head of the document and the relevant function call in the body. Those tasks can't all be performed by the lowly objectTag() function. The Rollover "object" should really be an object plus a behavior, or maybe some of each combined into a command. Take a look at the files behind Insert Rollover, and you'll see the following happening:
In other words, you have an object file that calls on a command file to help it perform its function. If you examine the contents of the Commands file, you'll recognize several other files that are obviously linked to objects: Tabular Data.htm, Jump Menu.htm, LayoutCell.htm, LayoutTable.htm, Navigation Bar.htm, and Date.htm. Coloring Outside the LinesYou might want to mix the functionality of extension types for similar reasons. When you were reading through Chapter 3, "Creating Custom Behaviors," for instance, were you struck by how many JavaScripts you couldn't turn into behaviors because they didn't fit the mold of generic function/function call? If you created a command that inserted the proper JavaScript code instead of a behavior, you could overcome those limitationsbut for intuitive interface presentation, you still might want the command to show up in the Behaviors panel's actions list. The moral of the story is to never feel limited by extension types. Determine the best way to create the result you wantinsert code, manipulate code, whateverand then determine how you can mix and match extension types to make this work intuitively for your users. |