Boyzoid has a very nice, simple, and direct example of doing a custom component in Flex:
Flex Custom Components and Methods
This is a follow up to my last entry where I mentioned the potential need to add a function to the ViewStack component. (Be sure to read the comments on that entry. I had read the docs wrong and it wasn't necessary.)
By the way - Boyzoid is my Flex hero. He just recently learned Flex this year but is already teaching me a lot. You only need to look at Flogr to get a good idea of what a "newbie" can do with the power of Flex. (Ok, sorry to sound like an Adobe cheerleader, but I just can't get over how happy I am with Flex 2.)