Flex/Flash/Actionscript

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

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.

Related:

  • Here's an example of how to use complex UI components for the header renderers of a Flex Accordion component. Normally the Accordion only allows you to specify a Button as the header renderer, and any customization still requires you to subclass Button, so it's hard to get full control over…
    Tags: button, flexlib, example, repository, canvasbutton, source, distribution, svn, mxml, add
  • This is an example of using a slightly modified Flex Accordion to create a sweet looking menu. Someone on flexcoders asked how to make a menu like the one found here on Apple's website. Here's the example I came up with to do this: [SWF]http://dougmccune.com/flex/apple_accordion/AppleAccordionExample.swf,260, 615[/SWF] The Accordion This is…
    Tags: button, example, flexlib
  • James Ward already had a little writeup about Mint.com using Flex for some of their spending habit charting stuff, but what's even cooler to me is that they're using a few FlexLib components on the site. I got an email from Jason Putorti, a Flex dev with Mint, letting me…
    Tags: components, flexlib, component
Standard

13 thoughts on “New Component: CanvasButton added to FlexLib

  1. Hi Doug, thanks again for this nice and useful component (I’ve already left some comments on Flexcoders).

    Borek

  2. 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

  3. Swede says:

    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!

  4. 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!

  5. Mike says:

    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

  6. Pingback: ??????? » Blog Archive » ?????Flex??

  7. Pingback: Flex??

  8. Pingback: Flex?? « Sealyu's Blog

  9. Pingback: Flex????(?) | ?????

Comments are closed.