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
Note: this has been added to the SVN repository for FlexLib but is not yet in the distribution zip. The distribution zip will get updated once we have a bigger changeset (oh, and it’s coming…)
This movie requires Flash Player 9.
Hi Doug, thanks again for this nice and useful component (I’ve already left some comments on Flexcoders).
Borek
Hi Doug, I played around with your component and it unfortunately brakes the design view. I am quite happy to live in the MXML world but this can be an issue for designers (and to be honest, sometimes it’s quite convenient to be able to edit things in WYSIWYG mode).
But thanks for your component anyway.
Borek
Hi Doug, thanks for the component. I’m having a problem when trying to use an extension of CanvasButton as a headerRenderer for an Accordion. I get the following exception at runtime:
ReferenceError: Error #1065: Variable http://www.adobe.com/2006/flex/mx/internal::setDocumentDescriptor is not defined.
Am I doing something silly, or missing something?
Thanks!
great. but how would/could u change the shape of the button to something non-square?
Hi Doug, I am trying to use the component in Flex 3 and it doesn’t appear to like it, either in the IDE design view, via MXML, or if I instantiate programmatically within ActionsScript. Does this component work in Flex 3, or maybe no?
I was hoping to use it as a delegate headerRenderer for an Accordion header and I noticed that someone else on this post had the same issues, but their link is dead. Is there any info you could give me?
Can’t wait to see if this will work for me. The component looks great!
Bryan,
I’ve tested the component in Flex 3 and all seems to be OK with the latest FlexLib source code. However, I just added a new component to the FlexLib SVN repository specifically for using CanvasButton as a header renderer in an Accordion.
See: http://dougmccune.com/blog/2007/09/18/using-complex-headers-with-the-flex-accordion/
You are the freakin’ man!!! You have my vote for President! thx!!!
Cool, i ll use it !)
Thanks for this. Can you use the CanvasButton class to have the label text on a button wrap? If so, chow can you create a Custom Button class that extends the CanvasButton class and make sthe label text wrap?
thanks!
-Mike
Pingback: ??????? » Blog Archive » ?????Flex??
Pingback: Flex??
Pingback: Flex?? « Sealyu's Blog
Pingback: Flex????(?) | ?????