Understanding the Role of a Custom UI

The components that you have encountered in this book have come with fancy-looking custom UIs for their parameters. For example, when you open the Component Parameters panel, you are presented with short, descriptive labels for all of the parameters, as well as "tool tip" paragraphs of information about each specific parameter. These tool tips provide insight into what you can and cannot do with the parameters and guide your decision for choosing their values.

While it is obvious that a custom UI can provide more information about the parameters of a component, a custom UI can also check for errors in the values the user inputs. Suppose you created a component that asks for the dimensions of the user's stage. Obviously, the values of the two parameters should be numbers, but they also should not have negative values.

As another example, recall the text effect components discussed in Chapter 7-specifically, the FlushTextEffect component. We discussed the topic of shared fonts to understand how to use a custom font with the various effects instead of relying on device fonts. If you wanted to use a custom font, you had to enter the linkage name of the shared font into the component's parameter, whereas if you wanted to use a device font, you simply had to enter the font's name on the computer.

Now, suppose for a moment that you want to use a device font with the component, but you accidentally misspell the name of the font. That small mistake will completely break the component. Wouldn't it be nice if the UI prompted you, informing you that you are not specifying a device font, and a shared font will be used instead? This can be done with a custom UI.

You can now see that a custom UI can both ease the component customizing process and make a powerful error-checking tool. We'll use these techniques to build a custom UI for the RandomSquares component that I introduced in Chapter 10.




The Hidden Power of Flash Components
The Hidden Power of Flash Components
ISBN: 0782142109
EAN: 2147483647
Year: 2002
Pages: 111

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net