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