Search Flex Samples

New Component: CanvasButton added to FlexLib

I just made a quick new component and added it to FlexLib. It’s a Button component, but it allows you to add any child UI components to the button via MXML. So if you find the single icon and label format of the button to be a bit too restrictive, you can use this component to layout your button however you want. This is in response to a recent question asked on flexcoders.

So for example, in the sample below the top button is created like this:
View the source
View the documentation

<flexlib:CanvasButton width="150">
<mx:VBox height="100%" width="100%" verticalGap="0" >
<mx:Label text="This is a" width="100%" textAlign="left" />
<mx:VBox width="100%" horizontalAlign="center">
<mx:Canvas cornerRadius="5" backgroundColor="0xff0000" backgroundAlpha=".5" borderStyle="solid">
<mx:Label text="crazy" width="100%" fontSize="20" fontStyle="italic" fontWeight="bold" />
</mx:Canvas> </mx:VBox>
<mx:Label text="button!" width="100%" textAlign="right" />
</mx:VBox> </flexlib:CanvasButton>


Related Flex Samples

Learn Flex: Flex Samples | Flex Video Tutorials Flex Examples