n Flash, components have the power to save you a great deal of time and frustration. These pluggable, self-contained unitsconsisting of handy combinations of graphics and/or codeare just dropped into place as needed to fulfill a role in your application. You can use them over and over.
While pre-built components are often just what you need, knowing how to build your own, custom components is a skill that no one should eschew. This two-part article series is designed to show you everything you need to know to build custom components that can work in multiple versions of the Flash player.
In part 1
, I covered the basic heavy-lifting of creating the component. In this follow-up, I'll show you how to really extend the usefulness of that component to get the biggest bang for the buck.
In part 1, I started with a hard-coded MovieClip. From there, the clip was converted to accept a user-defined parameter, allowing the user to modify the values of the component remotely. I then added a Live Preview file for immediate visual feedback during adjustments, a plain text description about the functionality of the component, and a custom icon.
In this article, I will:
- Add a custom user interface for the component to the Properties pane
- Enhance the component with a custom class when it is initialized
- Make the code friendlier, and better insulated, by defining best-practices "getter" and "setter" wrappers
- Use XML to enhance the Reference panel description, and add the custom actions to the Action panel
- Package the component for distribution with the Extension Manager.
|Author's Note: The material from which this article was derived will be presented in a session called "Authoring Components" at the FlashForward 2005 conference in San Francisco, April 6-8.
To download the souce code for this article:
The first article covers steps 1 through 5, sequentially. Picking up where we left off, then is ...