I am extending VBox to make a Calendar component. What method should I override to add the code to dr开发者_JS百科aw itself? What is the difference between all these methods? Is there something I should be putting in each one, or is there a specific method I can just override, add my drawing code, and have it work?
Thanks!
This white-paper is perhaps the best source of information I have seen on the subject.
Deepa's MAX 2008 talk was easily the best and most easily understanding presentation on the topic. It shows exactly how to write components properly in Flex 3.
I also recommend this article:
http://maohao.wordpress.com/2009/02/02/6-steps-in-creating-custom-uicomponent-in-flex-halo-framework/
Briefly, if you're doing graphics operations to draw, you'll want to use override updateDisplayList()
and call invalidateDisplayList()
as necessary; if you're using subcomponents, you'll use commitProperties()/invalidateProperties()
. If you're dynamically sized, you'll need measure()
and invalidateSize()
.
Override updateDisplayList method of UIComponent
and do your drawing in it. Use the component's unscaledWidth
and unscaledHeight
as the bounds for drawing.
From Adobe Flex 3 Live Docs Advanced Visual Components in ActionScript - great source.
精彩评论