Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Master the Time-saving Power of Flash Components, Part 2 : Page 4

In part 1 of this series, you learned to build components that worked with multiple versions of Flash. In this follow-up you'll learn all the little extras that allow you to customize, extend, and distribute your components, for maximum ease and peace of mind.


advertisement
Step 9: Enhance the Reference and Actions Panels with XML
Now that you've gone to the trouble of writing familiar syntax for users to modify this component on the fly, you have to tell them about it. By changing the component's description text from plain text to XML, you can enhance the Reference Panel info to reflect your component, and add your custom actions to the Actions Panel. To do this, create a well-formed XML document based on the template provided by Macromedia. Space limitations prevent me from going over this in great detail, but I'll explain enough to get your started. Also, check the Related Resources links in the left-hand column of this article page for some links with more detail. Listing 1 is an excerpt from the finished file.

The "actionspanel" node of this XML document is for adding Actions to the Actions panel. Inside this node, you add as many folders as necessary. These create the expandable entries in the Actions Panel that are preceeded by "notebook" icons. So, a simple object with methods and properties would have three folders: The object, its methods, and its properties. Above, I'm using one of my methods, setBackgroundAlpha, as an example. Following the sample file, I've created a folder for the component, an enclosed folder listing its methods and, within that, each method I want to list. (Again, I'm showing only one to keep the display concise.) A unique name and id is associated with each entry, as well as which version of Flash the action is intended for. You can also add tool tip text for rollover help. The method listing also needs the syntax, the object it is a child of, and the type of action it is (procedure, function, event, etc.) If any of this isn't immediately obvious from having used the Actions panel, you can find out more about each option in the Related Resources (see left column).

You can also add color syntax instructions and even code hints that come up when you're using the actions in the Actions panel. For example, it can remind you to use an integer with .setBackgroundAlpha(). Those options have been omitted here, but are included in the source files. The second major node is for the Reference panel. Here you can add the same formatting used by the rest of the Reference panel, for clarity and uniformity. This includes sections like usage, parameters, what the action returns (if anything), syntax examples, and so on. It also lets you use the CSS styles the Reference panel uses, like "titleStyle," "subTitle," and "codeStyle" so everything will look consistent with Flash's own documentation.



When the XML is complete and well-formed, you can place this document in the Flash Configuration directory that I discussed in part 1 of this article. However, instead of placing this file in the "Components" folder, it goes in the "ActionsPanel/CustomActions" folder.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap