How about this: http://dougmccune.com/blog/2007/06/01/new-component-canvasbutton-added-to-flexlib/
Doug On 6/1/07, Ely Greenfield <[EMAIL PROTECTED]> wrote:
Hi Borek. I can give you the short answer, which is that composition is an important goal of the flex framework. But we have two design goals which WPF doesn't have – specifically - keeping the framework something that will perform well on the 98% of the machines on the internet that currently have flash deployed (WPF has much heavier client requirements). - keeping MXML something that a developer and/or designer can look at, easily read and comprehend, and code by hand as appropriate (most XAML files that I see tend to be fairly hard to read to the typical developer). Both of these have forced us to walk a delicate line between power and simplicity in our component framework, and composability is one of those areas where we have been forced to make hard tradeoffs (and continue to debate them on a daily basis). Having said that, the move to Flash Player 9, AS3, and the new AVM+ has given us additional power (usable on the broad majority of the internet…over 85% penetration at this point, I believe) that we've only just begun to take advantage of in the framework. Expect to see us weaving composition deeper and deeper into the framework as it evolves. I should also mention that there's technically nothing stopping you from making composable controls like flexible buttons today. Personally, I believe it's worth every flex developers time to learn a little bit of component development; while there may be an initial up front learning investment, Once you have the knowledge, banging out a couple of custom built or reusable components doesn't take a lot of work. But building that kind of flexibility into every push button in every flex application, without paying a non-trivial cost in performance and complexity, is something that takes time and consideration. Ely. *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *borekbe *Sent:* Friday, June 01, 2007 9:31 AM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Really complex buttons (aka what WPF got right) Hi, I'm still learning Flex and during the last few hours, I've been struggling with some button-related problems. I am trying to create a button which contains not only label and icon but any arbitrary contents. If Flex was WPF, you could do something like <mx:Button> <mx:VBox> <mx:Label ... /> <mx:Image ... /> <custom:Component ... /> </mx:VBox> </mx:Button> This approach really saves a lot of time and hassle but unfortunately is not implemented in Flex (this would be great for future versions). What I did in Flex was that I created a custom component based on Canvas (say MyButton) and designed it however I wanted. I've set the buttonMode property to true so I now have the nice hand cursor. Click event is automatically there... So far so good. But the ultimate goal is to have something like TabNavigator, except that the tabs are pretty complicated MyButtons. No again, because the TabBar is based on buttons, you can only set label and icon. I don't think I can help myself creating a new class based on TabBar because the Button limitation would be still there. As far as I can see it, to have a custom button is fairly common scenario and I can't believe that Flex makes it so hard for me as a developer. There must be some way that I have simply missed. Could anyone more experienced please advise me, or generally comment on Flex composability of more advanced controls? Thanks, Borek