Inherit, Composite, or Rolling Your Own
One thing that a lot of developers mull over is whether their components should use a pure inheritance chain from UIComponent or a subclass thereof. Is the sum of their components parts through composition, or do you just ignore the whole component framework because of its perceived file size overhead and just go it alone?
If you want to get the most out of component development for the Flex framework, use a combination of inheritance and composition utilizing those classes that already exist within the Flex and Component frameworks—these can include your own components as you develop them. However, if you want to make a component that will work in both Flex and Flash,1 you will have issues from the outset. This is mainly because Flash and Flex use slightly different component models. Flash's is designed to be lightweight and simple to skin visually via the Flash Authoring tool. Flex's is more robust and contains more unified features that you would expect and need in rich application development; that is not to say that some of the classes you may create to be used by your component couldn't be shared between the two. I, for example, use utility classes that operate identically both within a pure Flash project and a Flex application. To be honest, you will create cleaner and more resilient components if you target only one format.
If you are interested in seeing how you can leverage Flash to create components for Flex, you can find out how in Chapter 11, "Creating Flex Components with Flash Professional CS5." If you feel that the component framework is too heavy and you'd rather "roll your own," go for it; however, before you decide whether that is the path for you, let's briefly look at what UIComponent has to offer, just so you can see what you might want to include in your own component if you do go it alone.